List of usage examples for javax.swing ActionMap get
public Action get(Object key)
key
, messaging the parent ActionMap
if the binding is not locally defined. From source file:au.org.ala.delta.intkey.ui.FindInCharactersDialog.java
public FindInCharactersDialog(Intkey intkeyApp, IntkeyContext context) { super(intkeyApp.getMainFrame(), false); setResizable(false);//from w ww. j a v a 2 s. c o m ResourceMap resourceMap = Application.getInstance().getContext() .getResourceMap(FindInCharactersDialog.class); resourceMap.injectFields(this); ActionMap actionMap = Application.getInstance().getContext().getActionMap(this); _intkeyApp = intkeyApp; _numMatchedCharacters = 0; _currentMatchedCharacter = -1; _findAction = actionMap.get("findCharacters"); _nextAction = actionMap.get("nextCharacter"); this.setTitle(windowTitle); _pnlMain = new JPanel(); _pnlMain.setBorder(new EmptyBorder(20, 20, 20, 20)); getContentPane().add(_pnlMain, BorderLayout.CENTER); _pnlMain.setLayout(new BorderLayout(0, 0)); _pnlMainTop = new JPanel(); _pnlMain.add(_pnlMainTop, BorderLayout.NORTH); _pnlMainTop.setLayout(new BoxLayout(_pnlMainTop, BoxLayout.Y_AXIS)); _lblEnterSearchString = new JLabel(enterSearchStringCaption); _lblEnterSearchString.setBorder(new EmptyBorder(0, 0, 5, 0)); _pnlMainTop.add(_lblEnterSearchString); _textField = new JTextField(); _pnlMainTop.add(_textField); _textField.setColumns(10); _textField.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { reset(); } @Override public void insertUpdate(DocumentEvent e) { reset(); } @Override public void changedUpdate(DocumentEvent e) { reset(); } }); _pnlMainBottom = new JPanel(); _pnlMainBottom.setBorder(new EmptyBorder(20, 0, 0, 0)); _pnlMain.add(_pnlMainBottom, BorderLayout.CENTER); _pnlMainBottom.setLayout(new BoxLayout(_pnlMainBottom, BoxLayout.Y_AXIS)); _chckbxSearchStates = new JCheckBox(searchStatesCaption); _chckbxSearchStates.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainBottom.add(_chckbxSearchStates); _chckbxSearchUsedCharacters = new JCheckBox(searchUsedCharactersCaption); _chckbxSearchUsedCharacters.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainBottom.add(_chckbxSearchUsedCharacters); _pnlButtons = new JPanel(); _pnlButtons.setBorder(new EmptyBorder(20, 0, 0, 10)); getContentPane().add(_pnlButtons, BorderLayout.EAST); _pnlButtons.setLayout(new BorderLayout(0, 0)); _pnlInnerButtons = new JPanel(); _pnlButtons.add(_pnlInnerButtons, BorderLayout.NORTH); GridBagLayout gbl__pnlInnerButtons = new GridBagLayout(); gbl__pnlInnerButtons.columnWidths = new int[] { 0, 0 }; gbl__pnlInnerButtons.rowHeights = new int[] { 0, 0, 0, 0 }; gbl__pnlInnerButtons.columnWeights = new double[] { 0.0, Double.MIN_VALUE }; gbl__pnlInnerButtons.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE }; _pnlInnerButtons.setLayout(gbl__pnlInnerButtons); _btnFindNext = new JButton(); _btnFindNext.setAction(_findAction); GridBagConstraints gbc__btnFindNext = new GridBagConstraints(); gbc__btnFindNext.fill = GridBagConstraints.HORIZONTAL; gbc__btnFindNext.insets = new Insets(0, 0, 5, 0); gbc__btnFindNext.gridx = 0; gbc__btnFindNext.gridy = 0; _pnlInnerButtons.add(_btnFindNext, gbc__btnFindNext); _btnPrevious = new JButton(); _btnPrevious.setAction(actionMap.get("previousCharacter")); _btnPrevious.setEnabled(false); GridBagConstraints gbc__btnPrevious = new GridBagConstraints(); gbc__btnPrevious.insets = new Insets(0, 0, 5, 0); gbc__btnPrevious.gridx = 0; gbc__btnPrevious.gridy = 1; _pnlInnerButtons.add(_btnPrevious, gbc__btnPrevious); _btnDone = new JButton(); _btnDone.setAction(actionMap.get("findCharactersDone")); GridBagConstraints gbc__btnDone = new GridBagConstraints(); gbc__btnDone.fill = GridBagConstraints.HORIZONTAL; gbc__btnDone.gridx = 0; gbc__btnDone.gridy = 2; _pnlInnerButtons.add(_btnDone, gbc__btnDone); this.pack(); this.setLocationRelativeTo(_intkeyApp.getMainFrame()); }
From source file:examples.gp.monalisa.gui.GeneticDrawingView.java
/** This method is called from within the constructor to * initialize the form./*from w w w . j a va 2 s .co m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { mainPanel = new javax.swing.JPanel(); chooseImage = new javax.swing.JButton(); startEvolution = new javax.swing.JToggleButton(); targetImageLabel = new javax.swing.JLabel(); saveCheckBox = new JCheckBox(); saveCheckBox.setText("Save every fittest result to file"); targetSaveDirLabel = new JLabel("Target directory:"); try { targetSaveDirEdit = new JLabel(FileKit.getCurrentDir()); } catch (IOException ex) { targetSaveDirEdit = new JLabel(); } JFreeChart chart = ChartFactory.createXYLineChart("Fitness versus Generation", "Generation", "Fitness", new XYSeriesCollection(new XYSeries("")), org.jfree.chart.plot.PlotOrientation.VERTICAL, false, false, false); chartPanel = new ChartPanel(chart); menuBar = new javax.swing.JMenuBar(); javax.swing.JMenu fileMenu = new javax.swing.JMenu(); javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem(); javax.swing.JMenu helpMenu = new javax.swing.JMenu(); javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem(); mainPanel.setName("mainPanel"); // NOI18N javax.swing.ActionMap actionMap = org.jdesktop.application.Application .getInstance(examples.gp.monalisa.gui.GeneticDrawingApp.class).getContext() .getActionMap(GeneticDrawingView.class, this); chooseImage.setAction(actionMap.get("chooseImage")); // NOI18N org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application .getInstance(examples.gp.monalisa.gui.GeneticDrawingApp.class).getContext() .getResourceMap(GeneticDrawingView.class); chooseImage.setText(resourceMap.getString("chooseImage.text")); // NOI18N chooseImage.setName("chooseImage"); // NOI18N startEvolution.setAction(actionMap.get("startEvolution")); // NOI18N startEvolution.setText(resourceMap.getString("startEvolution.text")); // NOI18N startEvolution.setName("startEvolution"); // NOI18N targetImageLabel.setIcon(resourceMap.getIcon("targetImageLabel.icon")); // NOI18N targetImageLabel.setText(resourceMap.getString("targetImageLabel.text")); // NOI18N targetImageLabel.setName("targetImageLabel"); // NOI18N chartPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); chartPanel.setName("chartPanel"); // NOI18N org.jdesktop.layout.GroupLayout chartPanelLayout = new org.jdesktop.layout.GroupLayout(chartPanel); chartPanel.setLayout(chartPanelLayout); chartPanelLayout.setHorizontalGroup(chartPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(0, 399, Short.MAX_VALUE)); chartPanelLayout.setVerticalGroup(chartPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(0, 234, Short.MAX_VALUE)); org.jdesktop.layout.GroupLayout mainPanelLayout = new org.jdesktop.layout.GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(mainPanelLayout.createSequentialGroup().add(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(mainPanelLayout.createSequentialGroup().add(47, 47, 47).add(chooseImage) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(startEvolution) .add(38, 38, 38)) .add(mainPanelLayout.createSequentialGroup().add(47, 47, 47).add(saveCheckBox).add(140, 140, 140)) .add(mainPanelLayout.createSequentialGroup().add(47, 47, 47).add(targetSaveDirLabel) .add(targetSaveDirEdit).add(47, 47, 47)) .add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup() .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(targetImageLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 200, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(80, 80, 80))) .add(chartPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); mainPanelLayout.setVerticalGroup(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup() .addContainerGap() .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, chartPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(mainPanelLayout.createSequentialGroup().add(saveCheckBox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(targetSaveDirLabel).add(targetSaveDirEdit) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(targetImageLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(startEvolution).add(chooseImage)))) .addContainerGap())); chooseImage.getAccessibleContext() .setAccessibleName(resourceMap.getString("jButton1.AccessibleContext.accessibleName")); // NOI18N menuBar.setName("menuBar"); // NOI18N fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N fileMenu.setName("fileMenu"); // NOI18N exitMenuItem.setAction(actionMap.get("quit")); // NOI18N exitMenuItem.setName("exitMenuItem"); // NOI18N fileMenu.add(exitMenuItem); menuBar.add(fileMenu); helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N helpMenu.setName("helpMenu"); // NOI18N aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N aboutMenuItem.setName("aboutMenuItem"); // NOI18N helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); setComponent(mainPanel); setMenuBar(menuBar); }
From source file:au.org.ala.delta.editor.ui.CharacterTree.java
public CharacterTree() { setToggleClickCount(0);//w w w. j a va 2 s . c om _characterListBehaviour = new CharacterListBehaviour(); _stateListBehaviour = new StateListBehaviour(); ToolTipManager.sharedInstance().registerComponent(this); addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (_doubleProcessingMouseEvent) { return; } if (!isEditing()) { int selectedRow = getClosestRowForLocation(e.getX(), e.getY()); if ((selectedRow >= 0) && (e.getClickCount() == 2) && SwingUtilities.isLeftMouseButton(e)) { Action action = getActionMap().get(SELECTION_ACTION_KEY); if (action != null) { action.actionPerformed(new ActionEvent(this, -1, "")); } } } } }); addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { TreePath selection = e.getNewLeadSelectionPath(); if (selection != null) { Object lastComponent = selection.getLastPathComponent(); if (lastComponent instanceof DefaultMutableTreeNode) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) lastComponent; if (node.isLeaf()) { CharacterTree.super.setTransferHandler(_stateTransferHandler); } else { CharacterTree.super.setTransferHandler(_characterTransferHandler); } } } } }); ActionMap actionMap = Application.getInstance().getContext().getActionMap(this); javax.swing.Action find = actionMap.get("find"); if (find != null) { getActionMap().put("find", find); } javax.swing.Action findNext = actionMap.get("findNext"); if (findNext != null) { getActionMap().put("findNext", findNext); } getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.CTRL_MASK), SELECTION_ACTION_KEY); }
From source file:au.org.ala.delta.intkey.ui.FindInTaxaDialog.java
public FindInTaxaDialog(Intkey intkeyApp) { super(intkeyApp.getMainFrame(), false); setResizable(false);// ww w . j ava 2 s . co m ResourceMap resourceMap = Application.getInstance().getContext().getResourceMap(FindInTaxaDialog.class); resourceMap.injectFields(this); ActionMap actionMap = Application.getInstance().getContext().getActionMap(this); _intkeyApp = intkeyApp; _numMatchedTaxa = 0; _currentMatchedTaxon = -1; _findAction = actionMap.get("findTaxa"); _nextAction = actionMap.get("nextFoundTaxon"); this.setTitle(windowTitle); getContentPane().setLayout(new BorderLayout(0, 0)); _pnlMain = new JPanel(); _pnlMain.setBorder(new EmptyBorder(20, 20, 20, 20)); getContentPane().add(_pnlMain, BorderLayout.CENTER); _pnlMain.setLayout(new BorderLayout(0, 0)); _pnlMainTop = new JPanel(); _pnlMain.add(_pnlMainTop, BorderLayout.NORTH); _pnlMainTop.setLayout(new BoxLayout(_pnlMainTop, BoxLayout.Y_AXIS)); _lblEnterSearchString = new JLabel(enterSearchStringCaption); _lblEnterSearchString.setBorder(new EmptyBorder(0, 0, 5, 0)); _lblEnterSearchString.setHorizontalAlignment(SwingConstants.LEFT); _lblEnterSearchString.setVerticalAlignment(SwingConstants.TOP); _lblEnterSearchString.setAlignmentY(Component.TOP_ALIGNMENT); _pnlMainTop.add(_lblEnterSearchString); _textField = new JTextField(); _textField.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { reset(); } @Override public void insertUpdate(DocumentEvent e) { reset(); } @Override public void changedUpdate(DocumentEvent e) { reset(); } }); _pnlMainTop.add(_textField); _textField.setColumns(10); _pnlMainMiddle = new JPanel(); _pnlMainMiddle.setBorder(new EmptyBorder(10, 0, 0, 0)); _pnlMain.add(_pnlMainMiddle, BorderLayout.CENTER); _pnlMainMiddle.setLayout(new BoxLayout(_pnlMainMiddle, BoxLayout.Y_AXIS)); _rdbtnSelectOne = new JRadioButton(selectOneCaption); _rdbtnSelectOne.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainMiddle.add(_rdbtnSelectOne); _rdbtnSelectAll = new JRadioButton(selectAllCaption); _rdbtnSelectAll.setSelected(true); _rdbtnSelectAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainMiddle.add(_rdbtnSelectAll); ButtonGroup radioButtonGroup = new ButtonGroup(); radioButtonGroup.add(_rdbtnSelectOne); radioButtonGroup.add(_rdbtnSelectAll); _pnlMainBottom = new JPanel(); _pnlMain.add(_pnlMainBottom, BorderLayout.SOUTH); _pnlMainBottom.setLayout(new BoxLayout(_pnlMainBottom, BoxLayout.Y_AXIS)); _chckbxSearchSynonyms = new JCheckBox(searchSynonymsCaption); _chckbxSearchSynonyms.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainBottom.add(_chckbxSearchSynonyms); _chckbxSearchEliminatedTaxa = new JCheckBox(searchEliminatedTaxaCaption); _chckbxSearchEliminatedTaxa.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainBottom.add(_chckbxSearchEliminatedTaxa); _pnlButtons = new JPanel(); _pnlButtons.setBorder(new EmptyBorder(20, 0, 0, 10)); getContentPane().add(_pnlButtons, BorderLayout.EAST); _pnlButtons.setLayout(new BorderLayout(0, 0)); _pnlInnerButtons = new JPanel(); _pnlButtons.add(_pnlInnerButtons, BorderLayout.NORTH); GridBagLayout gbl_pnlInnerButtons = new GridBagLayout(); gbl_pnlInnerButtons.columnWidths = new int[] { 0, 0 }; gbl_pnlInnerButtons.rowHeights = new int[] { 0, 0, 0, 0 }; gbl_pnlInnerButtons.columnWeights = new double[] { 0.0, Double.MIN_VALUE }; gbl_pnlInnerButtons.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE }; _pnlInnerButtons.setLayout(gbl_pnlInnerButtons); _btnFindNext = new JButton(); _btnFindNext.setAction(_findAction); GridBagConstraints gbc_btnFind = new GridBagConstraints(); gbc_btnFind.fill = GridBagConstraints.HORIZONTAL; gbc_btnFind.insets = new Insets(0, 0, 5, 0); gbc_btnFind.gridx = 0; gbc_btnFind.gridy = 0; _pnlInnerButtons.add(_btnFindNext, gbc_btnFind); _btnPrevious = new JButton(); _btnPrevious.setAction(actionMap.get("previousFoundTaxon")); _btnPrevious.setEnabled(false); GridBagConstraints gbc_btnPrevious = new GridBagConstraints(); gbc_btnPrevious.insets = new Insets(0, 0, 5, 0); gbc_btnPrevious.gridx = 0; gbc_btnPrevious.gridy = 1; _pnlInnerButtons.add(_btnPrevious, gbc_btnPrevious); _btnDone = new JButton(); _btnDone.setAction(actionMap.get("findTaxaDone")); GridBagConstraints gbc_btnDone = new GridBagConstraints(); gbc_btnDone.fill = GridBagConstraints.HORIZONTAL; gbc_btnDone.gridx = 0; gbc_btnDone.gridy = 2; _pnlInnerButtons.add(_btnDone, gbc_btnDone); this.pack(); this.setLocationRelativeTo(_intkeyApp.getMainFrame()); }
From source file:au.org.ala.delta.editor.ui.ImageDetailsPanel.java
/** * Displays the currently selected image. *///w w w .j a v a2s.c o m @Action public void displayImage() { if (_selectedImage == null) { return; } ActionMap actions = Application.getInstance().getContext().getActionMap(); actions.get("viewImageEditor").actionPerformed(null); }
From source file:au.org.ala.delta.intkey.ui.CharacterImageDialog.java
private void buildMenuItems() { ActionMap actionMap = Application.getInstance().getContext().getActionMap(CharacterImageDialog.class, this); _mnuItNextCharacter = new JMenuItem(); _mnuItNextCharacter.setAction(actionMap.get("viewNextCharacter")); _mnuControl.add(_mnuItNextCharacter); _mnuItPreviousCharacter = new JMenuItem(); _mnuItPreviousCharacter.setAction(actionMap.get("viewPreviousCharacter")); _mnuControl.add(_mnuItPreviousCharacter); }
From source file:au.org.ala.delta.editor.ui.ActionSetsDialog.java
public ActionSetsDialog(EditorViewModel model) { _model = model;/* ww w. jav a 2 s . com*/ _resources = Application.getInstance().getContext().getResourceMap(); _actions = Application.getInstance().getContext().getActionMap(this); ActionMap editorActions = Application.getInstance().getContext().getActionMap(); _actions.put("viewDirectivesEditor", editorActions.get("viewDirectivesEditor")); _actions.put("exportDirectives", editorActions.get("exportDirectives")); _messageHelper = new MessageDialogHelper(); createUI(); addEventHandlers(); updateGUI(); }
From source file:gg.msn.ui.panel.MainPanel.java
/** This method is called from within the constructor to * initialize the form./* w ww. j a va2 s.c o m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { nickLabel = new javax.swing.JLabel(); jToolBar1 = new javax.swing.JToolBar(); selectThemeButton = new javax.swing.JButton(); chat = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); disconnect = new javax.swing.JButton(); clientListScrollPane = new javax.swing.JScrollPane(); clientsList = new javax.swing.JList(); nickIcon = new javax.swing.JLabel(); setName("Form"); // NOI18N org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application .getInstance(gg.msn.ui.ChatClientApp.class).getContext().getResourceMap(MainPanel.class); nickLabel.setFont(resourceMap.getFont("nickLabel.font")); // NOI18N nickLabel.setText(resourceMap.getString("nickLabel.text")); // NOI18N nickLabel.setName("nickLabel"); // NOI18N jToolBar1.setFloatable(false); jToolBar1.setBorderPainted(false); jToolBar1.setName("jToolBar1"); // NOI18N jToolBar1.setOpaque(false); javax.swing.ActionMap actionMap = org.jdesktop.application.Application .getInstance(gg.msn.ui.ChatClientApp.class).getContext().getActionMap(MainPanel.class, this); selectThemeButton.setAction(actionMap.get("showFacebookOptionsDialog")); // NOI18N selectThemeButton.setIcon(resourceMap.getIcon("selectThemeButton.icon")); // NOI18N selectThemeButton.setText(resourceMap.getString("selectThemeButton.text")); // NOI18N selectThemeButton.setToolTipText(resourceMap.getString("selectThemeButton.toolTipText")); // NOI18N selectThemeButton.setFocusable(false); selectThemeButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); selectThemeButton.setName("selectThemeButton"); // NOI18N selectThemeButton.setOpaque(false); selectThemeButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jToolBar1.add(selectThemeButton); chat.setAction(actionMap.get("addChatWithSelected")); // NOI18N chat.setIcon(resourceMap.getIcon("chat.icon")); // NOI18N chat.setToolTipText(resourceMap.getString("chat.toolTipText")); // NOI18N chat.setFocusable(false); chat.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); chat.setName("chat"); // NOI18N chat.setOpaque(false); chat.setPreferredSize(new java.awt.Dimension(59, 59)); chat.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jToolBar1.add(chat); jButton1.setAction(actionMap.get("showAboutBox")); // NOI18N jButton1.setIcon(resourceMap.getIcon("jButton1.icon")); // NOI18N jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N jButton1.setFocusable(false); jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton1.setName("jButton1"); // NOI18N jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jToolBar1.add(jButton1); disconnect.setAction(actionMap.get("disconnetti")); // NOI18N disconnect.setIcon(resourceMap.getIcon("disconnect.icon")); // NOI18N disconnect.setToolTipText(resourceMap.getString("disconnect.toolTipText")); // NOI18N disconnect.setFocusable(false); disconnect.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); disconnect.setName("disconnect"); // NOI18N disconnect.setOpaque(false); disconnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jToolBar1.add(disconnect); clientListScrollPane.setBackground(new Color(255, 255, 255, 100)); clientListScrollPane.setBorder(null); clientListScrollPane .setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); clientListScrollPane.setName("clientListScrollPane"); // NOI18N clientListScrollPane.setOpaque(false); clientsList.setBackground(new Color(255, 255, 255, 100)); clientsList.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("clientsList.border.title"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("clientsList.border.titleFont"))); // NOI18N clientsList.setModel(new DefaultListModel()); clientsList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); clientsList.setCellRenderer(new ClientsListCellRenderer()); clientsList.setFocusable(false); clientsList.setInheritsPopupMenu(true); clientsList.setName("clientsList"); // NOI18N clientsList.setOpaque(false); clientsList.setSelectionBackground(new Color(204, 204, 204, 150)); clientsList.setVisibleRowCount(1); clientListScrollPane.setViewportView(clientsList); nickIcon.setIcon(resourceMap.getIcon("nickIcon.icon")); // NOI18N nickIcon.setName("nickIcon"); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(clientListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup().addComponent(nickIcon) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(nickLabel))) .addContainerGap()) .addComponent(jToolBar1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(nickLabel).addComponent(nickIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(clientListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE) .addContainerGap())); }
From source file:au.org.ala.delta.intkey.ui.AddOrEditDataIndexItemDialog.java
private void init() { ActionMap actionMap = Application.getInstance().getContext().getActionMap(this); ResourceMap resourceMap = Application.getInstance().getContext() .getResourceMap(AddOrEditDataIndexItemDialog.class); resourceMap.injectFields(this); _pnlMain = new JPanel(); getContentPane().add(_pnlMain, BorderLayout.CENTER); _lblDescription = new JLabel(descriptionCaption); _txtFldDescription = new JTextField(); _txtFldDescription.setColumns(10);/*from ww w . j a v a 2 s .c o m*/ _btnBrowse = new JButton(); _btnBrowse.setAction(actionMap.get("AddOrEditDataIndexItemDialog_Browse")); _lblFilePath = new JLabel(pathCaption); _txtFldFilePath = new JTextField(); _txtFldFilePath.setColumns(10); GroupLayout gl__pnlMain = new GroupLayout(_pnlMain); gl__pnlMain.setHorizontalGroup(gl__pnlMain.createParallelGroup(Alignment.LEADING).addGroup(gl__pnlMain .createSequentialGroup().addContainerGap() .addGroup(gl__pnlMain.createParallelGroup(Alignment.LEADING, false) .addComponent(_lblFilePath, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(_lblDescription, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl__pnlMain.createParallelGroup(Alignment.TRAILING) .addGroup(gl__pnlMain.createSequentialGroup() .addComponent(_txtFldFilePath, GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(_btnBrowse)) .addComponent(_txtFldDescription, GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE)) .addContainerGap())); gl__pnlMain.setVerticalGroup(gl__pnlMain.createParallelGroup(Alignment.LEADING) .addGroup(gl__pnlMain.createSequentialGroup().addContainerGap() .addGroup(gl__pnlMain.createParallelGroup(Alignment.BASELINE).addComponent(_lblDescription) .addComponent(_txtFldDescription, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl__pnlMain.createParallelGroup(Alignment.BASELINE) .addComponent(_btnBrowse, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) .addComponent(_txtFldFilePath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(_lblFilePath, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)) .addContainerGap(25, Short.MAX_VALUE))); _pnlMain.setLayout(gl__pnlMain); _pnlButtons = new JPanel(); getContentPane().add(_pnlButtons, BorderLayout.SOUTH); _btnOk = new JButton(); _btnOk.setAction(actionMap.get("AddOrEditDataIndexItemDialog_OK")); _pnlButtons.add(_btnOk); _btnCancel = new JButton(); _btnCancel.setAction(actionMap.get("AddOrEditDataIndexItemDialog_Cancel")); _pnlButtons.add(_btnCancel); }
From source file:au.org.ala.delta.editor.ui.image.ImageSettingsDialog.java
private void addEventHandlers() { ActionMap actions = Application.getInstance().getContext().getActionMap(this); btnOk.setAction(actions.get("okImageSettingsChanges")); btnApply.setAction(actions.get("applyImageSettingsChanges")); btnCancel.setAction(actions.get("cancelImageSettingsChanges")); imagePathButton.setAction(actions.get("addToImagePath")); javax.swing.Action defaultFontChange = actions.get("defaultFontPropertyChanged"); defaultFontCombo.setAction(defaultFontChange); defaultSizeCombo.setAction(defaultFontChange); defaultBoldCheckBox.setAction(defaultFontChange); defaultBoldCheckBox.setText(""); defaultItalicCheckBox.setAction(defaultFontChange); defaultItalicCheckBox.setText(""); FocusListener defaultFontFocusListener = new FocusAdapter() { @Override/*from ww w. j a v a 2 s . c om*/ public void focusGained(FocusEvent e) { defaultFontPropertyChanged(); } }; defaultFontCombo.addFocusListener(defaultFontFocusListener); defaultSizeCombo.addFocusListener(defaultFontFocusListener); javax.swing.Action featureFontChange = actions.get("featureFontPropertyChanged"); featureFontCombo.setAction(featureFontChange); featureSizeCombo.setAction(featureFontChange); featureBoldCheckBox.setAction(featureFontChange); featureBoldCheckBox.setText(""); featureItalicCheckBox.setAction(featureFontChange); featureItalicCheckBox.setText(""); FocusListener featureFontFocusListener = new FocusAdapter() { @Override public void focusGained(FocusEvent e) { featureFontPropertyChanged(); } }; featureFontCombo.addFocusListener(featureFontFocusListener); featureSizeCombo.addFocusListener(featureFontFocusListener); javax.swing.Action buttonFontChange = actions.get("buttonFontPropertyChanged"); buttonFontCombo.setAction(buttonFontChange); buttonSizeCombo.setAction(buttonFontChange); buttonBoldCheckBox.setAction(buttonFontChange); buttonBoldCheckBox.setText(""); buttonItalicCheckBox.setAction(buttonFontChange); buttonItalicCheckBox.setText(""); FocusListener buttonFontFocusListener = new FocusAdapter() { @Override public void focusGained(FocusEvent e) { buttonFontPropertyChanged(); } }; buttonFontCombo.addFocusListener(buttonFontFocusListener); buttonSizeCombo.addFocusListener(buttonFontFocusListener); chooseColourButton.setAction(actions.get("displayColourChooser")); }