use of javax.swing.JMenuItem in project EnrichmentMapApp by BaderLab.
the class ColumnHeaderRankOptionRenderer method menuButtonClicked.
private void menuButtonClicked(JTable table, JButton button) {
JTableHeader header = table.getTableHeader();
List<RankingOption> rankOptions = mainPanel.getAllRankingOptions();
JPopupMenu menu = new JPopupMenu();
for (RankingOption rankOption : rankOptions) {
JMenuItem item = new JCheckBoxMenuItem(rankOption.getName());
item.setSelected(rankOption == mainPanel.getSelectedRankOption());
SwingUtil.makeSmall(item);
menu.add(item);
item.addActionListener(e -> mainPanel.updateSetting_RankOption(rankOption));
}
int y = button.getHeight();
int x = 0;
for (int i = 0; i < colIndex; i++) {
TableColumn tableColumn = table.getColumnModel().getColumn(i);
x += tableColumn.getWidth();
}
menu.show(header, x, y);
}
use of javax.swing.JMenuItem in project ACS by ACS-Community.
the class ScriptFilter method getFileMenuSaveStatusButton.
/**
* This method initializes FileMenuSaveStatusButton
* @return javax.swing.JMenuItem
*/
private JMenuItem getFileMenuSaveStatusButton() {
if (FileMenuSaveStatusButton == null) {
FileMenuSaveStatusButton = new JMenuItem();
FileMenuSaveStatusButton.setText("Save GUI status");
FileMenuSaveStatusButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
JFileChooser chooser = new JFileChooser();
int returnVal = chooser.showSaveDialog(cl.utfsm.samplingSystemUI.SamplingSystemGUI.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
try {
String file = chooser.getSelectedFile().getAbsolutePath();
if (file.endsWith(".ssgst")) {
writeStatusFile(file);
} else {
writeStatusFile(file + ".ssgst");
}
} catch (ParserConfigurationException e1) {
e1.printStackTrace();
} catch (TransformerException e1) {
e1.printStackTrace();
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
}
}
});
}
return FileMenuSaveStatusButton;
}
use of javax.swing.JMenuItem in project ACS by ACS-Community.
the class LogMenuBar method getSaveFileMenuItem.
/**
* Returns the SaveFileMenuItem property value.
* @return javax.swing.JMenuItem
*/
public JMenuItem getSaveFileMenuItem() {
if (saveFileMenuItem == null) {
ImageIcon icon = new ImageIcon(LogTypeHelper.class.getResource("/disk.png"));
saveFileMenuItem = new JMenuItem("Save File As", icon);
saveFileMenuItem.setName("SaveFileMenuItem");
}
return saveFileMenuItem;
}
use of javax.swing.JMenuItem in project ACS by ACS-Community.
the class LogMenuBar method getLoadDBMenuItem.
/**
* Returns the LoadDB menu item
*
* @return The LoadDB menu item
*/
public JMenuItem getLoadDBMenuItem() {
if (loadDBMenuItem == null) {
ImageIcon icon = new ImageIcon(LogTypeHelper.class.getResource("/database.png"));
loadDBMenuItem = new JMenuItem("Load from database", icon);
loadDBMenuItem.setName("LoadDBMenuItem");
}
return loadDBMenuItem;
}
use of javax.swing.JMenuItem in project ACS by ACS-Community.
the class LogMenuBar method getFiltersMenuItem.
/**
* Return the editFiltersMenuItem
* @return
*/
public JMenuItem getFiltersMenuItem() {
if (filtersMenuItem == null) {
ImageIcon filterIcon = new ImageIcon(LogTypeHelper.class.getResource("/filters.png"));
filtersMenuItem = new JMenuItem("Filters...", filterIcon);
filtersMenuItem.setName("EditFiltersMenuItem");
}
return filtersMenuItem;
}
Aggregations