List of usage examples for javax.swing JToggleButton getText
public String getText()
From source file:edu.ku.brc.af.ui.forms.FormViewObj.java
/** * Shows a Dialog to setup Carry Forward. * The hard part is figuring out which fields are candidates for Carry Forward. *//*w ww . j a v a2s . com*/ public void configureCarryForward() { CarryForwardInfo carryForwardInfo = getCarryForwardInfo(); DBTableInfo tblInfo = DBTableIdMgr.getInstance().getByClassName(view.getClassName()); Vector<FVOFieldInfo> itemLabels = new Vector<FVOFieldInfo>(); Vector<FVOFieldInfo> selectedItems = new Vector<FVOFieldInfo>(carryForwardInfo.getFieldList()); buildFieldInfoList(itemLabels, tblInfo); ToggleButtonChooserDlg<FVOFieldInfo> dlg = new ToggleButtonChooserDlg<FVOFieldInfo>( (Frame) UIRegistry.getTopWindow(), "CONFIG_CARRY_FORWARD_TITLE", itemLabels); dlg.setUseScrollPane(true); dlg.setAddSelectAll(true); dlg.createUI(); HashMap<String, JToggleButton> tgBtnHash = new HashMap<String, JToggleButton>(); Vector<JToggleButton> btns = dlg.getPanel().getButtons(); for (JToggleButton tb : btns) { tgBtnHash.put(tb.getText(), tb); } for (FVOFieldInfo itm : itemLabels) { if (itm.isRequired()) { JToggleButton togBtn = tgBtnHash.get(itm.getLabel()); if (togBtn != null) { togBtn.setEnabled(false); selectedItems.add(itm); } } } dlg.setSelectedObjects(selectedItems); UIHelper.centerAndShow(dlg); if (!dlg.isCancelled()) { carryForwardInfo.add(dlg.getSelectedObjects()); } notifyUIPluginsOfChanges(true, null); }
From source file:org.paxle.desktop.impl.dialogues.cconsole.CrawlingConsole.java
public void actionPerformed(ActionEvent e) { final String ac = e.getActionCommand(); if (ac == AC_CLEAR) { clear();// w ww . j av a 2 s . c o m } else if (ac == AC_CRAWL) { updateCpb(cpb.isSelected(), false, true); } else if (ac == AC_SELECT) { updateCpb(false, true, false); } else if (ac == AC_SETTINGS) { final JToggleButton btn = (JToggleButton) e.getSource(); final boolean sel = btn.isSelected(); btn.setText(((sel) ? '\u2191' : '\u2193') + btn.getText().substring(1)); final boolean notInitialized = sel && options.getComponentCount() == 0; if (notInitialized) initOptions(); final Runnable sr = new Runnable() { public void run() { int height = options.getHeight(); frame.setSize(frame.getWidth(), frame.getHeight() + ((sel) ? height : -height)); } }; if (!notInitialized) sr.run(); options.setVisible(sel); if (notInitialized) SwingUtilities.invokeLater(sr); } if (ac == AC_SELECT || ac == AC_ENQUEUED || ac == AC_DESTROYED) { final String compItem = (String) cbox.getSelectedItem(); final boolean enq = cbEnq.isSelected(); final boolean dstr = cbDstr.isSelected(); if (logger.isDebugEnabled()) logger.debug("received ActionEvent, item: '" + compItem + "', enq: " + enq + ", dstr: " + dstr); updateListeners(MWComponents.valueOfHumanReadable(compItem), enq, dstr); /* model.setType((cbDstr.isSelected()) ? TableDisplay.REJECTED : (cbEnq.isSelected()) ? TableDisplay.WORKING_ON : new TableColumns()); */ } }
From source file:org.revager.tools.GUITools.java
/** * Creates a new image toggle button.//ww w .j a va 2 s. c om * * @param icon * the normal icon * @param rolloverIcon * the rollover icon * @param action * the action * * @return the newly created image button */ public static JToggleButton newImageToggleButton(ImageIcon icon, ImageIcon rolloverIcon, Action action) { JToggleButton button = new JToggleButton(action); button.setToolTipText(button.getText()); button.setText(null); button.setContentAreaFilled(false); button.setBorder(new EmptyBorder(0, 0, 0, 0)); button.setMargin(new Insets(0, 0, 0, 0)); button.setBorderPainted(false); button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); button.setFocusPainted(false); button.setFocusable(false); button.setIcon(icon); button.setRolloverIcon(rolloverIcon); button.setRolloverSelectedIcon(rolloverIcon); button.setSelectedIcon(rolloverIcon); return button; }
From source file:org.ut.biolab.medsavant.client.view.component.KeyValuePairPanel.java
public void addMoreRow() { final JToggleButton b = ViewUtil.getSoftToggleButton("MORE"); ViewUtil.makeMini(b);/*from w ww .jav a 2 s .c o m*/ b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { toggleMoreVisibility(); if (b.getText().equals("MORE")) { b.setText("LESS"); } else { b.setText("MORE"); } } }); /* * final JLabel keyLabel = new JLabel(); ViewUtil.makeMini(keyLabel); * keyLabel.setForeground(Color.darkGray); * keyLabel.setBorder(ViewUtil.getMediumBorder()); * * keyLabel.setText(" MORE "); * * keyLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); * keyLabel.addMouseListener(new MouseAdapter() { @Override public void * mouseClicked(MouseEvent me) { toggleMoreVisibility(); * * if (keyLabel.getText().startsWith("")) { keyLabel.setText(" MORE * "); } else { keyLabel.setText(" LESS "); } * * } * }); */ toolbar.add(ViewUtil.getCenterAlignedComponent(b)); newRowsGoIntoMoreSection = true; }