{
Dimension dim;
JPanel ctrlPanel = new JPanel();
ctrlPanel.setLayout(new BorderLayout());
JTabbedPane tab = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
JGridBagPanel panelTree = new JGridBagPanel();
JGridBagPanel panelTable = new JGridBagPanel();
JGridBagPanel panelImage = new JGridBagPanel();
JGridBagPanel panelOther = new JGridBagPanel();
JGridBagPanel panelSlideShow = new JGridBagPanel();
JGridBagPanel panelToolTip = new JGridBagPanel();
panelTree.setBorder(new CompoundBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(5, 5, 5, 5)));
panelTable.setBorder(new CompoundBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(5,5,5,5)));
panelImage.setBorder(new CompoundBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(5,5,5,5)));
panelOther.setBorder(new CompoundBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(5,5,5,5)));
panelSlideShow.setBorder(new CompoundBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(5,5,5,5)));
panelToolTip.setBorder(new CompoundBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(5,5,5,5)));
/*
panelTree.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
panelTable.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
panelImage.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
panelOther.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
panelSlideShow.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
panelToolTip.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
*/
int row = 0;
// Tree
// FillTimer
panelTree.addComponent(new JLabel(Main.getString("settings_label_filltimer")), 0, row, GridBagConstraints.WEST, new Insets(5, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
m_spinner_FillTimer = new JNumberSpinner(new SpinnerNumberModel(0, 0, 10000, 50));
m_spinner_FillTimer.setValue(Main.m_settings.getFillListTimer());
row++;
panelTree.addComponent(m_spinner_FillTimer, GridBagConstraints.RELATIVE, row, GridBagConstraints.WEST, new Insets(2, 0, 0, 0));
panelTree.addComponent(new JLabel(Main.getString("settings_label_filltimer_msec")), GridBagConstraints.RELATIVE, row, GridBagConstraints.NORTHWEST, new Insets(2, 5, 0, 0));
// Table
// Display all Images
row = 0;
m_checkBox_displayAllImages = new JCheckBox(Main.getString("settings_checkbox_displayallimages"), Main.m_settings.isDisplayAllInages());
panelTable.addComponent(m_checkBox_displayAllImages, 0, row, GridBagConstraints.WEST, new Insets(5, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
// ImgDisplayTimer
row++;
panelTable.addComponent(new JLabel(Main.getString("settings_label_imgtimer")), 0, row, GridBagConstraints.WEST, new Insets(10, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
m_spinner_ImgDisplayTimer = new JNumberSpinner(new SpinnerNumberModel(0, 0, 10000, 50));
m_spinner_ImgDisplayTimer.setValue(Main.m_settings.getImgDisplayTimer());
row++;
panelTable.addComponent(m_spinner_ImgDisplayTimer, GridBagConstraints.RELATIVE, row, GridBagConstraints.WEST, new Insets(2, 0, 5, 0));
panelTable.addComponent(new JLabel(Main.getString("settings_label_imgtimer_msec")), 1, row, GridBagConstraints.NORTHWEST, new Insets(2, 5, 0, 0), GridBagConstraints.REMAINDER, 1);
// SortDeep
row++;
panelTable.addComponent(new JLabel(Main.getString("settings_label_sortdeep")), 0, row, GridBagConstraints.WEST, new Insets(10, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
m_spinner_SortDeep = new JNumberSpinner(new SpinnerNumberModel(1, 1, 30, 1));
m_spinner_SortDeep.setValue(Main.m_settings.getSortDeep());
row++;
panelTable.addComponent(m_spinner_SortDeep, GridBagConstraints.RELATIVE, row, GridBagConstraints.WEST, new Insets(2, 0, 5, 0));
// Image Extensions
row++;
panelTable.addComponent(new JLabel(Main.getString("settings_label_imgext")), 0, row, GridBagConstraints.WEST, new Insets(10, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
StringBuilder strBuilder = new StringBuilder();
for (String item : Main.m_settings.m_jpgExtensions)
{
if (strBuilder.length() != 0)
strBuilder.append(",");
strBuilder.append(item);
}
m_textField_extField = new JTextField(strBuilder.toString(), 16);
m_textField_extField.setMinimumSize(m_textField_extField.getPreferredSize());
row++;
panelTable.addComponent(m_textField_extField, GridBagConstraints.RELATIVE, row, GridBagConstraints.WEST, new Insets(2, 0, 10, 0), GridBagConstraints.REMAINDER, 1);
// Image
row = 0;
m_comboBox_saveImage = new JComboBox();
m_comboBox_saveImage.addItem(Main.getString("settings_combobox_saveimg_no"));
m_comboBox_saveImage.addItem(Main.getString("settings_combobox_saveimg_yes"));
m_comboBox_saveImage.addItem(Main.getString("settings_combobox_saveimg_ask"));
m_comboBox_saveImage.setSelectedIndex(Main.m_settings.getSaveImage());
row++;
panelImage.addComponent(new JLabel(Main.getString("settings_label_imgsave")), GridBagConstraints.RELATIVE, row, GridBagConstraints.WEST, new Insets(5, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
row++;
panelImage.addComponent(m_comboBox_saveImage, GridBagConstraints.RELATIVE, row, GridBagConstraints.WEST, new Insets(5, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
// Cache size
row++;
panelImage.addComponent(new JLabel(Main.getString("settings_label_imgCacheSize")), 0, row, GridBagConstraints.WEST, new Insets(10, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
m_spinner_imgCacheSize = new JNumberSpinner(new SpinnerNumberModel(1, 1, 100, 1));
m_spinner_imgCacheSize.setValue(Main.m_settings.getImgCacheSize());
row++;
panelImage.addComponent(m_spinner_imgCacheSize, GridBagConstraints.RELATIVE, row, GridBagConstraints.WEST, new Insets(2, 0, 5, 0), GridBagConstraints.REMAINDER, 1);
// Use preload
row++;
m_checkBox_usePreload = new JCheckBox(Main.getString("settings_checkbox_usepreload"), Main.m_settings.isImgUsePreload());
panelImage.addComponent(m_checkBox_usePreload, GridBagConstraints.RELATIVE, row, GridBagConstraints.NORTHWEST, new Insets(5, 0, 5, 0), GridBagConstraints.REMAINDER, 1);
// Interpolation
m_comboBox_interpolation = new JComboBox();
m_comboBox_interpolation.addItem(Main.getString("settings_combobox_interpolation_neighbor"));
m_comboBox_interpolation.addItem(Main.getString("settings_combobox_interpolation_bilinear"));
m_comboBox_interpolation.addItem(Main.getString("settings_combobox_interpolation_bicubic"));
int h;
Object interpolation = Main.m_settings.getInterpolation();
if (interpolation.equals(RenderingHints.VALUE_INTERPOLATION_BILINEAR))
h = 1;
else if (interpolation.equals(RenderingHints.VALUE_INTERPOLATION_BICUBIC))
h = 2;
else h=0;
m_comboBox_interpolation.setSelectedIndex(h);
row++;
panelImage.addComponent(new JLabel(Main.getString("settings_label_interpolation")), GridBagConstraints.RELATIVE, row, GridBagConstraints.WEST, new Insets(5, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
row++;
panelImage.addComponent(m_comboBox_interpolation, GridBagConstraints.RELATIVE, row, GridBagConstraints.WEST, new Insets(5, 0, 5, 0), GridBagConstraints.REMAINDER, 1);
row++;
panelImage.addComponent(new JLabel(Main.getString("settings_label_backgroundcolor")), GridBagConstraints.RELATIVE, row, GridBagConstraints.WEST, new Insets(5, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
row++;
m_imgBackColorDisplay = new JLabel();
m_imgBackColorDisplay.setOpaque(true);
m_imgBackColorDisplay.setBackground(Main.m_settings.getImgViewBackColor());
m_imgBackColorDisplay.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED));
panelImage.addComponent(m_imgBackColorDisplay, GridBagConstraints.RELATIVE, row, GridBagConstraints.NORTHWEST, new Insets(5, 0, 0, 10), 1, 1);
final JButton imgBackColor = new JButton(Main.getString("settings_label_backgroundcolor_change"));
panelImage.addComponent(imgBackColor, 1, row, GridBagConstraints.WEST, new Insets(5, 0, 10, 0), GridBagConstraints.REMAINDER, 1);
dim = imgBackColor.getPreferredSize();
m_imgBackColorDisplay.setPreferredSize(new Dimension((int)dim.getHeight(), (int)dim.getHeight()));
m_imgBackColorDisplay.setMinimumSize(new Dimension((int)dim.getHeight(), (int)dim.getHeight()));
imgBackColor.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
Color col = JColorChooser.showDialog(imgBackColor.getParent(), Main.getString("settings_label_backgroundcolor_title"), m_imgBackColorDisplay.getBackground());
if (col != null)
{
m_imgBackColorDisplay.setBackground(col);
}
}
});
// Other
row = 0;
m_checkBox_confirmDelete = new JCheckBox(Main.getString("settings_checkbox_confirmdelete"), Main.m_settings.isDelConfirm());
panelOther.addComponent(m_checkBox_confirmDelete, 0, row, GridBagConstraints.WEST, new Insets(5, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
row++;
m_checkBox_confirmOverwrite = new JCheckBox(Main.getString("settings_checkbox_confirmoverwrite"), Main.m_settings.isOverwriteConfirm());
panelOther.addComponent(m_checkBox_confirmOverwrite, 0, row, GridBagConstraints.WEST, new Insets(5, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
row++;
m_checkBox_useFullScreenMode = new JCheckBox(Main.getString("settings_checkbox_usefullscreenmode"), Main.m_settings.getUseFullScreenMode());
panelOther.addComponent(m_checkBox_useFullScreenMode, 0, row, GridBagConstraints.WEST, new Insets(5, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
if (!GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().isFullScreenSupported())
{
m_checkBox_useFullScreenMode.setSelected(false);
m_checkBox_useFullScreenMode.setEnabled(false);
}
// Language
m_comboBox_language = new JComboBox();
String lang[] = Locale.getISOLanguages();
m_comboBox_language.addItem(String.format(Main.getString("settings_language_default"), Main.m_sysLocale.getLanguage()));
// m_comboBox_language.addItem(String.format(Main.getString("settings_language_default"), "en"));
for (String item : lang)
{
try
{
ResourceBundle resBundle = ResourceBundle.getBundle("JExifViewerLang_" + item);
m_comboBox_language.addItem(item);
}
catch(MissingResourceException ex)
{}
}
String loc = Main.m_settings.getLocale();
if (loc.length() != 0)
m_comboBox_language.setSelectedItem(loc);
else
m_comboBox_language.setSelectedIndex(0);
row++;
panelOther.addComponent(new JLabel(Main.getString("settings_label_language")), GridBagConstraints.RELATIVE, row, GridBagConstraints.WEST, new Insets(15, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
row++;
panelOther.addComponent(m_comboBox_language, 0, row, GridBagConstraints.WEST, new Insets(5, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
row++;
m_checkBox_checkUpdate = new JCheckBox(Main.getString("settings_checkbox_checkupdate"), Main.m_settings.isCheckUpdate());
panelOther.addComponent(m_checkBox_checkUpdate, 0, row, GridBagConstraints.WEST, new Insets(20, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
// Tooltip
row = 0;
final JCheckList list = new JCheckList();
m_listModel = list.getModel();
ArrayList<Integer> tagArray = new ArrayList<Integer>();
for (int tag : JExifDataModel.m_colTag)
{
if (tag != JExifTag.GPSTAG_TAG_MAPLINK)
tagArray.add(tag);
}
final String separator = Main.getString("list_separator");
for (int tag : Main.m_settings.m_toolTipTags)
{
JCheckListData<Integer> data = new JCheckListData<Integer>();
data.setLabel(tag >= 0 ? Main.getString(String.format("colheader_tag_0x%1$04X", tag)) : separator);
data.setChecked(true);
data.setIsSeparator(tag < 0);
data.setData(new Integer(tag));
m_listModel.addElement(data);
if (tag >= 0)
{
for (int i=0; i<tagArray.size(); i++)
{
if (tagArray.get(i) == tag)
{
tagArray.remove(i);
break;
}
}
}
}
for (int tag : tagArray)
{
JCheckListData<Integer> data = new JCheckListData<Integer>();
data.setLabel(Main.getString(String.format("colheader_tag_0x%1$04X", tag)));
data.setData(new Integer(tag));
m_listModel.addElement(data);
}
JCheckListData<Integer> data = new JCheckListData<Integer>();
data.setLabel("<" + separator + ">");
data.setIsSeparator(true);
m_listModel.addElement(data);
data = new JCheckListData<Integer>();
data.setLabel("<" + separator + ">");
data.setIsSeparator(true);
m_listModel.add(0, data);
JScrollPane scrollPane = new JScrollPane();
scrollPane.getViewport().add(list);
panelToolTip.addComponent(new JLabel(Main.getString("settings_label_tooltipfield")), 0, row, GridBagConstraints.WEST, new Insets(0, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
row++;
panelToolTip.addComponent(scrollPane, 0, row, GridBagConstraints.WEST, new Insets(0, 0, 0, 0), 1, 2);
final JButton upButton = new JButton("\u2191");
Font font = upButton.getFont().deriveFont(Font.BOLD, (float)24.0);
upButton.setFont(font);
upButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
int index = list.getSelectedIndex();
if (index > 0)
{
JCheckListData data = (JCheckListData)m_listModel.get(index);
if ((index == 2 || index == 1) && data.isSeparator())
{
m_listModel.remove(index);
list.setSelectedIndex(index-1);
list.ensureIndexIsVisible(0);
}
else if (index == m_listModel.getSize() - 1)
{
data = new JCheckListData<Integer>();
data.setLabel(separator);
data.setIsSeparator(true);
m_listModel.add(index, data);
list.setSelectedIndex(index);
list.ensureIndexIsVisible(index+1);
}
else if (index > 1)
{
data = (JCheckListData)m_listModel.get(index);
m_listModel.add(index-1, m_listModel.remove(index));
index--;
list.setSelectedIndex(index);
list.ensureIndexIsVisible(index);
}
}
if ((index = list.getSelectedIndex()) >= 0)
{
JCheckListData data = (JCheckListData)m_listModel.get(index);
upButton.setEnabled(index > 1 || data.isSeparator() ? true : false);
}
}
});
panelToolTip.addComponent(upButton, 1, row, GridBagConstraints.SOUTHWEST, new Insets(0, 10, 0, 0), 1, 1, 0, 0.5);
final JButton downButton = new JButton("\u2193");
downButton.setFont(font);
downButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
int index = list.getSelectedIndex();
if (index >= 0 && index < m_listModel.getSize() - 1)
{
JCheckListData data = (JCheckListData)m_listModel.get(index);
if ((index == m_listModel.getSize() - 3 || index == m_listModel.getSize() - 2) && data.isSeparator())
{
m_listModel.remove(index);
list.setSelectedIndex(m_listModel.getSize() - 2);
list.ensureIndexIsVisible(m_listModel.getSize() - 1);
}
else if (index == 0)
{
data = new JCheckListData<Integer>();
data.setLabel(separator);
data.setIsSeparator(true);
m_listModel.add(1, data);
list.setSelectedIndex(1);
list.ensureIndexIsVisible(0);
}
else if (index < m_listModel.getSize() - 2)
{
data = (JCheckListData)m_listModel.get(index);
m_listModel.add(index+1, m_listModel.remove(index));
index++;
list.setSelectedIndex(index);
list.ensureIndexIsVisible(index);
}
}
if ((index = list.getSelectedIndex()) >= 0)
{
JCheckListData data = (JCheckListData)m_listModel.get(index);
downButton.setEnabled(index < m_listModel.getSize() - 2 || data.isSeparator() ? true : false);
}
}
});
list.getSelectionModel().addListSelectionListener(new ListSelectionListener()
{
public void valueChanged(ListSelectionEvent e)
{
int index = list.getSelectedIndex();
if (index >= 0)
{
JCheckListData data = (JCheckListData)m_listModel.get(index);
upButton.setEnabled(index == 0 || (index == 1 && !data.isSeparator()) ? false : true);
downButton.setEnabled(index == m_listModel.getSize() - 1 || (index == m_listModel.getSize() - 2 && !data.isSeparator()) ? false : true);
}
}
});
row++;
panelToolTip.addComponent(downButton, 1, row, GridBagConstraints.NORTHWEST, new Insets(3, 10, 0, 0), 1, 1, 0, 0.5);
row++;
panelToolTip.addComponent(new JLabel(Main.getString("settings_label_tooltipdismissdelay")), 0, row, GridBagConstraints.WEST, new Insets(10, 0, 5, 0), GridBagConstraints.REMAINDER, 1);
row++;
m_spinner_ToolTips = new JNumberSpinner(new SpinnerNumberModel(20, 0, 60, 1));
m_spinner_ToolTips.setValue(Main.m_settings.getToolTipDismissDelay()/1000);
JPanel panelBox = new JPanel();
panelBox.setLayout(new BoxLayout(panelBox, BoxLayout.X_AXIS));
panelBox.add(m_spinner_ToolTips);
JLabel ttSec = new JLabel(Main.getString("settings_label_tooltipdismissdelay_sec"));
ttSec.setAlignmentY(Component.CENTER_ALIGNMENT);
panelBox.add(Box.createRigidArea(new Dimension(5, 0)));
panelBox.add(ttSec);
panelToolTip.addComponent(panelBox, 0, row, GridBagConstraints.WEST, new Insets(0, 0, 0, 0));
row++;
panelBox = new JPanel();
panelBox.setLayout(new BoxLayout(panelBox, BoxLayout.X_AXIS));
m_checkBox_tooltipTable = new JCheckBox(Main.getString("settings_checkbox_tooltiptable"), Main.m_settings.isToolTipTable());
panelBox.add(m_checkBox_tooltipTable);
row++;
m_checkBox_tooltipBold = new JCheckBox(Main.getString("settings_checkbox_tooltipbold"), Main.m_settings.isToolTipBold());
panelToolTip.addComponent(m_checkBox_tooltipBold, 1, row, GridBagConstraints.WEST, new Insets(0, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
panelBox.add(Box.createRigidArea(new Dimension(15, 0)));
panelBox.add(m_checkBox_tooltipBold);
panelToolTip.addComponent(panelBox, 0, row, GridBagConstraints.WEST, new Insets(10, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
// Slideshow
row = 0;
panelSlideShow.addComponent(new JLabel(Main.getString("settings_label_slideshowtimer")), 0, row, GridBagConstraints.WEST, new Insets(10, 0, 0, 0), GridBagConstraints.REMAINDER, 1);
row++;
m_spinner_SlideShowTimer = new JNumberSpinner(new SpinnerNumberModel(0, 0, 1000, 5));
m_spinner_SlideShowTimer.setValue(Main.m_settings.getSlideShowTimer()/1000);
panelSlideShow.addComponent(m_spinner_SlideShowTimer, 0, row, GridBagConstraints.WEST, new Insets(5, 0, 0, 0));
panelSlideShow.addComponent(new JLabel(Main.getString("settings_label_slideshowtimer_sec")), GridBagConstraints.RELATIVE, row, GridBagConstraints.WEST, new Insets(2, 5, 0, 0));
tab.addTab(Main.getString("settings_tab_tree"), panelTree);
tab.addTab(Main.getString("settings_tab_table"), panelTable);
tab.addTab(Main.getString("settings_tab_image"), panelImage);
tab.addTab(Main.getString("settings_tab_slideshow"), panelSlideShow);
tab.addTab(Main.getString("settings_tab_tooltip"), panelToolTip);
tab.addTab(Main.getString("settings_tab_other"), panelOther);
tab.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
tab.setFocusable(false);
setPreferredSize(new Dimension(500, 400));
ctrlPanel.add(tab, BorderLayout.NORTH);
this.setResizable(false);
addCtrlPanel(ctrlPanel);