public void setShdPopupOnBtnClick(boolean shdPopup) { this.shdPopup = shdPopup; if (shdPopup) { main.addActionListener(pl); } else { main.removeActionListener(pl); } }
public void addActions(JPanel buttPanel) { AbstractAction netcdfAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { String location = ds.getLocation(); if (location == null) location = "test"; int pos = location.lastIndexOf("."); if (pos > 0) location = location.substring(0, pos); String filename = fileChooser.chooseFilenameToSave(location + ".nc"); if (filename == null) return; writeNetCDF(filename); } }; BAMutil.setActionProperties(netcdfAction, "netcdf", "Write netCDF-3 file", false, 'S', -1); BAMutil.addActionToContainer(buttPanel, netcdfAction); AbstractAction ncstreamAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { String location = ds.getLocation(); if (location == null) location = "test"; int pos = location.lastIndexOf("."); if (pos > 0) location = location.substring(0, pos); String filename = fileChooser.chooseFilenameToSave(location + ".ncs"); if (filename == null) return; writeNcstream(filename); } }; BAMutil.setActionProperties(ncstreamAction, "netcdf", "Write ncstream file", false, 'S', -1); BAMutil.addActionToContainer(buttPanel, ncstreamAction); AbstractButton compareButton = BAMutil.makeButtcon("Select", "Compare to another file", false); compareButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { compareDataset(); } }); buttPanel.add(compareButton); AbstractAction attAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { showAtts(); } }; BAMutil.setActionProperties(attAction, "FontDecr", "global attributes", false, 'A', -1); BAMutil.addActionToContainer(buttPanel, attAction); }
private AbstractButton createButton( String text, ImageIcon icon, String toolTip, ActionListener actionListener) { AbstractButton button = new JButton(text, icon); button.setMaximumSize(buttonDimension); button.setPreferredSize(buttonDimension); if (toolTip != null) { button.setToolTipText(toolTip); } if (actionListener != null) { button.addActionListener(actionListener); } return button; }
/** * Default constructor. * * @param man view manager */ public TextView(final ViewNotifier man) { super(TEXTVIEW, man); border(5).layout(new BorderLayout(0, 5)); header = new BaseXHeader(RESULT); home = BaseXButton.command(GUIMenuCmd.C_HOME, gui); home.setEnabled(false); text = new TextPanel(false, gui); text.setSyntax(new SyntaxXML()); search = new SearchEditor(gui, text); final AbstractButton save = BaseXButton.get("c_save", SAVE, false, gui); final AbstractButton find = search.button(FIND); final BaseXBack buttons = new BaseXBack(false); buttons.layout(new TableLayout(1, 3, 1, 0)).border(0, 0, 4, 0); buttons.add(save); buttons.add(home); buttons.add(find); final BaseXBack b = new BaseXBack(false).layout(new BorderLayout()); b.add(buttons, BorderLayout.WEST); b.add(header, BorderLayout.EAST); add(b, BorderLayout.NORTH); add(search, BorderLayout.CENTER); save.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { save(); } }); refreshLayout(); }
public void addActionListener(ActionListener l) { main.addActionListener(l); listener = l; }