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);