private void updateTemplateFromEditor(PrintfTemplate template) { ArrayList params = new ArrayList(); String format = null; int text_length = editorPane.getDocument().getLength(); try { format = editorPane.getDocument().getText(0, text_length); } catch (BadLocationException ex1) { } Element section_el = editorPane.getDocument().getDefaultRootElement(); // Get number of paragraphs. int num_para = section_el.getElementCount(); for (int p_count = 0; p_count < num_para; p_count++) { Element para_el = section_el.getElement(p_count); // Enumerate the content elements int num_cont = para_el.getElementCount(); for (int c_count = 0; c_count < num_cont; c_count++) { Element content_el = para_el.getElement(c_count); AttributeSet attr = content_el.getAttributes(); // Get the name of the style applied to this content element; may be null String sn = (String) attr.getAttribute(StyleConstants.NameAttribute); // Check if style name match if (sn != null && sn.startsWith("Parameter")) { // we extract the label. JLabel l = (JLabel) StyleConstants.getComponent(attr); if (l != null) { params.add(l.getName()); } } } } template.setFormat(format); template.setTokens(params); }
/** * Sets the mute status icon to the status panel. * * @param isMute indicates if the call with this peer is muted */ public void setMute(final boolean isMute) { if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater( new Runnable() { public void run() { setMute(isMute); } }); return; } if (isMute) { muteStatusLabel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.MUTE_STATUS_ICON))); muteStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 3)); } else { muteStatusLabel.setIcon(null); muteStatusLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); } // Update input volume control button state to reflect the current // mute status. if (localLevel.isSelected() != isMute) localLevel.setSelected(isMute); this.revalidate(); this.repaint(); }
public MacRenderer() { renderer = new JLabel(); renderer.setOpaque(Preferences.getBoolean("jeti", "bmw", true)); renderer.setBackground(UIManager.getColor("Tree.selectionBackground")); renderer.setForeground(UIManager.getColor("Tree.textForeground")); renderer.setFont(UIManager.getFont("Tree.font")); }
public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { final Color color = UIUtil.getTableFocusCellBackground(); Component component; final Module module = value instanceof Module ? (Module) value : null; try { UIManager.put(UIUtil.TABLE_FOCUS_CELL_BACKGROUND_PROPERTY, table.getSelectionBackground()); component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (module != null) { setText( module.getName() + " (" + FileUtil.toSystemDependentName(module.getModuleFilePath()) + ")"); } if (component instanceof JLabel) { ((JLabel) component).setBorder(noFocusBorder); } } finally { UIManager.put(UIUtil.TABLE_FOCUS_CELL_BACKGROUND_PROPERTY, color); } component.setEnabled(ProcessedModulesTable.this.isEnabled()); if (component instanceof JLabel) { final Icon icon = module != null ? ModuleType.get(module).getIcon() : null; JLabel label = (JLabel) component; label.setIcon(icon); label.setDisabledIcon(icon); } component.setForeground(isSelected ? table.getSelectionForeground() : table.getForeground()); return component; }
public void evaluate() { try { // clear problems and console messages problemsView.setText(""); consoleView.setText(""); // update status view statusView.setText(" Parsing ..."); tabbedPane.setSelectedIndex(0); LispExpr root = Parser.parse(textView.getText()); statusView.setText(" Running ..."); tabbedPane.setSelectedIndex(1); // update run button runButton.setIcon(stopImage); runButton.setActionCommand("Stop"); // start run thread runThread = new RunThread(root); runThread.start(); } catch (SyntaxError e) { tabbedPane.setSelectedIndex(0); System.err.println( "Syntax Error at " + e.getLine() + ", " + e.getColumn() + " : " + e.getMessage()); } catch (Error e) { // parsing error System.err.println(e.getMessage()); statusView.setText(" Errors."); } }
@Override public Component getListCellRendererComponent( JList<? extends E> list, E value, int index, boolean isSelected, boolean cellHasFocus) { label.setText(Objects.toString(value, "")); this.list = list; this.index = index; if (isSelected) { setBackground(list.getSelectionBackground()); label.setForeground(list.getSelectionForeground()); } else { setBackground(index % 2 == 0 ? EVEN_COLOR : list.getBackground()); label.setForeground(list.getForeground()); } MutableComboBoxModel m = (MutableComboBoxModel) list.getModel(); if (index < 0 || m.getSize() - 1 <= 0) { setOpaque(false); deleteButton.setVisible(false); label.setForeground(list.getForeground()); } else { boolean f = index == rolloverIndex; setOpaque(true); deleteButton.setVisible(true); deleteButton.getModel().setRollover(f); deleteButton.setForeground(f ? Color.WHITE : list.getForeground()); } return this; }
public IGEgui() { start = new JPanel(); randomizer = new JPanel(); randomButton = new JButton("Randomize"); locationButton = new JButton("Randomize"); locationField = new JTextField(10); welcomeL = new JLabel(); instructL = new JLabel(); restaurantL = new JLabel(); setDefaultCloseOperation(EXIT_ON_CLOSE); setTitle("Random Restaurant Generator"); setSize(300, 150); locationButton.addActionListener(this); randomButton.addActionListener(this); welcomeL.setText("Welcome to the Random Restaurant Generator!"); instructL.setText("Please enter your location (Zip code/City, State)"); restaurantL.setText(""); start.add(welcomeL); start.add(instructL); start.add(locationField); start.add(locationButton); randomizer.add(restaurantL); randomizer.add(randomButton); setContentPane(start); }
public PlayerPanel(ActionListener listener) { Dimension size; Insets in = this.getInsets(); this.numberOfPlayersButtons = new ArrayList<JButton>(this.possiblePlayersAmount); this.colorButtons = new LinkedList<JButton>(); label = new JLabel("Escolha a quantidade de jogadores:"); this.add(label); size = label.getPreferredSize(); label.setBounds(90, 5 + in.top, size.width, size.height); for (int i = 0; i < this.possiblePlayersAmount; i++) { JButton tempButton = new JButton(String.format("%d", i + 3)); numberOfPlayersButtons.add(tempButton); size = tempButton.getPreferredSize(); tempButton.setBounds(45 + 75 * i + in.left, 80 + in.top, size.width, size.height); tempButton.addActionListener(listener); this.add(tempButton); } this.setSize(this.getPreferredSize()); this.setLayout(null); this.listener = listener; }
public void actionPerformed(ActionEvent evt) { Object src = evt.getSource(); try { if (src == propDialog) { propDialog_actionPerformed(evt); } else { pdu = new BlockPdu(context); if (src == setButton) { pdu.setPduType(BlockPdu.SET); pdu.addOid(toid.getText(), new AsnOctets(tvalue.getText())); } else if (src == getButton) { pdu.setPduType(BlockPdu.GET); pdu.addOid(toid.getText()); } else if (src == getNextButton) { pdu.setPduType(BlockPdu.GETNEXT); pdu.addOid(toid.getText()); } sendRequest(pdu); } } catch (Exception exc) { exc.printStackTrace(); lmessage.setText("Exception: " + exc.getMessage()); lmessage.setBackground(Color.red); } }
public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { final Color color = UIUtil.getTableFocusCellBackground(); Component component; T t = (T) value; try { UIManager.put(UIUtil.TABLE_FOCUS_CELL_BACKGROUND_PROPERTY, table.getSelectionBackground()); component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); setText(t != null ? getItemText(t) : ""); if (component instanceof JLabel) { ((JLabel) component).setBorder(noFocusBorder); } } finally { UIManager.put(UIUtil.TABLE_FOCUS_CELL_BACKGROUND_PROPERTY, color); } final MyTableModel model = (MyTableModel) table.getModel(); component.setEnabled( ElementsChooser.this.isEnabled() && (myColorUnmarkedElements ? model.isElementMarked(row) : true)); final ElementProperties properties = myElementToPropertiesMap.get(t); if (component instanceof JLabel) { final Icon icon = properties != null ? properties.getIcon() : t != null ? getItemIcon(t) : null; JLabel label = (JLabel) component; label.setIcon(icon); label.setDisabledIcon(icon); } component.setForeground( properties != null && properties.getColor() != null ? properties.getColor() : (isSelected ? table.getSelectionForeground() : table.getForeground())); return component; }
private void createHealthPanel() { remove(healthPanel); remove(statsPanel); lblPlayerHealth.setText( "<html><font color='green'>" + GamePanel.healthPlayer + "</font></html>"); lblMrSawyerHealth.setText( "<html><font color='green'>" + GamePanel.healthMrSawyer + "</font></html>"); lblVikrantHealth.setText( "<html><font color='green'>" + GamePanel.healthVikrant + "</font></html>"); lblVarunHealth.setText("<html><font color='green'>" + GamePanel.healthVarun + "</font></html>"); lblBrianHealth.setText("<html><font color='green'>" + GamePanel.healthBrian + "</font></html>"); healthPanel.setLayout(new GridLayout(5, 2)); healthPanel.setBackground(new Color(0xd2b48c)); healthPanel.add(lblPlayerName); healthPanel.add(lblPlayerHealth); healthPanel.add(lblMrSawyerName); healthPanel.add(lblMrSawyerHealth); healthPanel.add(lblVikrantName); healthPanel.add(lblVikrantHealth); healthPanel.add(lblVarunName); healthPanel.add(lblVarunHealth); healthPanel.add(lblBrianName); healthPanel.add(lblBrianHealth); add(healthPanel, BorderLayout.WEST); revalidate(); repaint(); }
public void updateHealth() { if (GamePanel.healthPlayer > 0) lblPlayerHealth.setText( "<html><font color='green'>" + GamePanel.healthPlayer + "</font></html>"); else lblPlayerHealth.setText( "<html><font color='red'>" + GamePanel.healthPlayer + "</font></html>"); if (GamePanel.healthMrSawyer > 0) lblMrSawyerHealth.setText( "<html><font color='green'>" + GamePanel.healthMrSawyer + "</font></html>"); else lblMrSawyerHealth.setText( "<html><font color='red'>" + GamePanel.healthMrSawyer + "</font></html>"); if (GamePanel.healthVikrant > 0) lblVikrantHealth.setText( "<html><font color='green'>" + GamePanel.healthVikrant + "</font></html>"); else lblVikrantHealth.setText( "<html><font color='red'>" + GamePanel.healthVikrant + "</font></html>"); if (GamePanel.healthVarun > 0) lblVarunHealth.setText( "<html><font color='green'>" + GamePanel.healthVarun + "</font></html>"); else lblVarunHealth.setText("<html><font color='red'>" + GamePanel.healthVarun + "</font></html>"); if (GamePanel.healthBrian > 0) lblBrianHealth.setText( "<html><font color='green'>" + GamePanel.healthBrian + "</font></html>"); else lblBrianHealth.setText("<html><font color='red'>" + GamePanel.healthBrian + "</font></html>"); }
protected JLabel createActionLabel( final AnAction anAction, final String anActionName, final Color fg, final Color bg, final Icon icon) { final LayeredIcon layeredIcon = new LayeredIcon(2); layeredIcon.setIcon(EMPTY_ICON, 0); if (icon != null && icon.getIconWidth() <= EMPTY_ICON.getIconWidth() && icon.getIconHeight() <= EMPTY_ICON.getIconHeight()) { layeredIcon.setIcon( icon, 1, (-icon.getIconWidth() + EMPTY_ICON.getIconWidth()) / 2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight()) / 2); } final Shortcut[] shortcutSet = KeymapManager.getInstance().getActiveKeymap().getShortcuts(getActionId(anAction)); final String actionName = anActionName + (shortcutSet != null && shortcutSet.length > 0 ? " (" + KeymapUtil.getShortcutText(shortcutSet[0]) + ")" : ""); final JLabel actionLabel = new JLabel(actionName, layeredIcon, SwingConstants.LEFT); actionLabel.setBackground(bg); actionLabel.setForeground(fg); return actionLabel; }
private void helpButtonActionPerformed(java.awt.event.ActionEvent evt) { JPopupMenu jp = new JPopupMenu(); JMenuItem mi = new JMenuItem("Help"); // No i18n JPanel panel = new JPanel(); String msgTxt = "<html>Drops redundant events/alerts. <br>The suppressed/dropped Events/alerts will not <br>be added to the database. <br>You can choose to suppress all events/alerts <br>or only those that occur after a <br>certain period of time. <br>Refer Admin Guide for details.</html>"; // No i18n /*JTextArea ep = new JTextArea(); ep.setColumns(20); ep.setLineWrap(true); ep.setRows(10); ep.setBackground(new java.awt.Color(200, 200, 200)); ep.setWrapStyleWord(true);*/ JLabel ep = new JLabel(); ep.setSize(300, 200); ep.setText(msgTxt); panel.add(ep); mi.setLayout(new BorderLayout()); mi.setPreferredSize(panel.getPreferredSize()); mi.setFocusPainted(false); mi.add(panel, BorderLayout.CENTER); jp.setLayout(new BorderLayout()); jp.add(mi, BorderLayout.CENTER); jp.show(helpButton, -60, -60); }
private void updateCountLabel() { int placesCount = 0; int enablePlacesCount = 0; final List<InjInfo> items = myInjectionsTable.getListTableModel().getItems(); if (!items.isEmpty()) { for (InjInfo injection : items) { for (InjectionPlace place : injection.injection.getInjectionPlaces()) { placesCount++; if (place.isEnabled()) enablePlacesCount++; } } myCountLabel.setText( items.size() + " injection" + (items.size() > 1 ? "s" : "") + " (" + enablePlacesCount + " of " + placesCount + " place" + (placesCount > 1 ? "s" : "") + " enabled) "); } else { myCountLabel.setText("no injections configured "); } }
private void sendRequest(BlockPdu pdu) { setButton.setEnabled(false); getButton.setEnabled(false); getNextButton.setEnabled(false); lmessage.setText("Sending request .."); lmessage.setBackground(Color.white); try { varbind var = pdu.getResponseVariableBinding(); AsnObjectId oid = var.getOid(); AsnObject res = var.getValue(); if (res != null) { toid.setText(oid.toString()); tvalue.setText(res.toString()); lmessage.setText("Received aswer "); lmessage.setBackground(Color.white); } else { lmessage.setText("Received no aswer "); lmessage.setBackground(Color.red); } } catch (PduException exc) { lmessage.setText("PduException: " + exc.getMessage()); lmessage.setBackground(Color.red); exc.printStackTrace(); } catch (java.io.IOException exc) { lmessage.setText("IOException: " + exc.getMessage()); lmessage.setBackground(Color.red); exc.printStackTrace(); } setButton.setEnabled(true); getButton.setEnabled(true); getNextButton.setEnabled(true); }
public InjectionsSettingsUI(final Project project, final Configuration configuration) { myProject = project; myConfiguration = configuration; final CfgInfo currentInfo = new CfgInfo(configuration, "Project"); myInfos = configuration instanceof Configuration.Prj ? new CfgInfo[] { new CfgInfo(((Configuration.Prj) configuration).getParentConfiguration(), "IDE"), currentInfo } : new CfgInfo[] {currentInfo}; myRoot = new JPanel(new BorderLayout()); myInjectionsTable = new InjectionsTable(getInjInfoList(myInfos)); myInjectionsTable.getEmptyText().setText("No injections configured"); ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myInjectionsTable); createActions(decorator); // myRoot.add(new TitledSeparator("Languages injection places"), BorderLayout.NORTH); myRoot.add(decorator.createPanel(), BorderLayout.CENTER); myCountLabel = new JLabel(); myCountLabel.setHorizontalAlignment(SwingConstants.RIGHT); myCountLabel.setForeground(SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES.getFgColor()); myRoot.add(myCountLabel, BorderLayout.SOUTH); updateCountLabel(); }
private int addButton(SIPCommButton button, int gridX, int xBounds, boolean isLast) { lastAddedButton = button; constraints.insets = new Insets(0, 0, V_GAP, 0); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.NONE; constraints.gridx = gridX; constraints.gridy = 2; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 0f; constraints.weighty = 0f; this.add(button, constraints); int yBounds = TOP_BORDER + BOTTOM_BORDER + 2 * V_GAP + ComponentUtils.getStringSize(nameLabel, nameLabel.getText()).height + ComponentUtils.getStringSize(displayDetailsLabel, displayDetailsLabel.getText()) .height; button.setBounds(xBounds, yBounds, BUTTON_WIDTH, BUTTON_HEIGHT); button.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); setButtonBg(button, gridX, isLast); return button.getWidth(); }
@Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { // Get the renderer component from parent class JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); // Get icon to use for the list item value Character character = (Character) value; Config.ConfigEntry ce = config.get(character.getName()); Icon icon = null; if (ce == null) { icon = icons.get(NOTOK); label.setToolTipText( "Double-click to enter configuration information for this character, right-click for more options"); } else { if (ce.isOk()) { icon = icons.get(OK); ui.exportAllButton.setEnabled(true); } else { icon = icons.get(NOTOK); } } // Set icon to display for value label.setIcon(icon); return label; }
public SplitPaneDemo() { // Create the list of images and put it in a scroll pane. list = new JList(imageNames); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setSelectedIndex(0); list.addListSelectionListener(this); JScrollPane listScrollPane = new JScrollPane(list); picture = new JLabel(); picture.setFont(picture.getFont().deriveFont(Font.ITALIC)); picture.setHorizontalAlignment(JLabel.CENTER); JScrollPane pictureScrollPane = new JScrollPane(picture); // Create a split pane with the two scroll panes in it. splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, listScrollPane, pictureScrollPane); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(150); // Provide minimum sizes for the two components in the split pane. Dimension minimumSize = new Dimension(100, 50); listScrollPane.setMinimumSize(minimumSize); pictureScrollPane.setMinimumSize(minimumSize); // Provide a preferred size for the split pane. splitPane.setPreferredSize(new Dimension(400, 200)); updateLabel(imageNames[list.getSelectedIndex()]); }
/** To highlight a message, call #warnUser. */ private void setStatusBarTextHighlighted(boolean highlighted, Color color) { // Use #coordinateLabel rather than (unattached) dummy label because // dummy label's background does not change when L&F changes. [Jon // Aquino] messageLabel.setForeground(highlighted ? Color.black : coordinateLabel.getForeground()); messageLabel.setBackground(highlighted ? color : coordinateLabel.getBackground()); }
/** * Creates the panel that appears when there are no pages * * @return JPanel */ protected JPanel createFirstPanel() { firstButtonPanel = new JPanel(new GridBagLayout()); firstButtonPanel.setBorder(BorderFactory.createLineBorder(Color.black)); firstButtonPanel.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent _evt) { if (OSPRuntime.isPopupTrigger(_evt)) return; // SwingUtilities.isRightMouseButton(_evt)) return; if (!firstButtonPanel.isEnabled()) return; Object obj = JOptionPane.showInputDialog( getComponent(), res.getString("TabbedEditor.NewName"), res.getString("TabbedEditor.Rename"), JOptionPane.QUESTION_MESSAGE, null, null, getUniqueName(defaultString)); if (obj == null) return; String txt = obj.toString().trim(); if (txt.length() > 0) addPage(defaultType, txt, null, true); else addPage(defaultType, defaultString, null, true); } }); String label = res.getOptionalString("TabbedEditor.ClickHere." + defaultHeader); if (label == null) label = res.getString("TabbedEditor.ClickHere"); firstButton = new JLabel(label); firstButton.setFont(firstButton.getFont().deriveFont(TabbedEditor.BUTTON_FONT_SIZE)); firstButtonPanel.add(firstButton); JPanel firstPanel = new JPanel(new GridLayout(0, 1)); firstPanel.add(firstButtonPanel); return firstPanel; }
/** * Creates the <tt>Component</tt> hierarchy of the area of status-related information such as * <tt>CallPeer</tt> display name, call duration, security status. * * @return the root of the <tt>Component</tt> hierarchy of the area of status-related information * such as <tt>CallPeer</tt> display name, call duration, security status */ private Component createStatusBar() { // stateLabel callStatusLabel.setForeground(Color.WHITE); dtmfLabel.setForeground(Color.WHITE); callStatusLabel.setText(callPeer.getState().getLocalizedStateString()); PeerStatusPanel statusPanel = new PeerStatusPanel(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; statusPanel.add(securityStatusLabel, constraints); initSecurityStatusLabel(); constraints.gridx++; statusPanel.add(holdStatusLabel, constraints); constraints.gridx++; statusPanel.add(muteStatusLabel, constraints); constraints.gridx++; callStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 12)); statusPanel.add(callStatusLabel, constraints); constraints.gridx++; constraints.weightx = 1f; statusPanel.add(dtmfLabel, constraints); return statusPanel; }
public HeaderPanel(String heading) { super(); this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.setBackground(background); JLabel panelLabel = new JLabel(" " + heading, SwingConstants.LEFT); Font labelFont = new Font("Dialog", Font.BOLD, 18); panelLabel.setFont(labelFont); this.add(panelLabel); this.add(Box.createHorizontalGlue()); refresh = new JButton("Refresh"); refresh.addActionListener(this); this.add(refresh); this.add(Box.createHorizontalStrut(5)); root = new JComboBox(); Dimension d = root.getPreferredSize(); d.width = 90; root.setPreferredSize(d); root.setMaximumSize(d); File[] roots = directoryPane.getRoots(); for (int i = 0; i < roots.length; i++) root.addItem(roots[i].getAbsolutePath()); this.add(root); root.setSelectedIndex(directoryPane.getCurrentRootIndex()); root.addActionListener(this); this.add(Box.createHorizontalStrut(17)); }
public static void writeTopString(String s) { if (s == null) { return; } statusLabel.setForeground(Color.black); statusLabel.setText(" " + s); }
/** @inheritDoc */ public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component c = candidate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (c instanceof JLabel && table != null) { ViperTableModel m = getCurrentModel(); int modelIndex = table.convertColumnIndexToModel(column); AttrConfig ac = m.getAttributeForColumn(modelIndex); JLabel l = (JLabel) c; if (ac != null) { int visibility = mediator.getHiders().getAttrConfigVisibility(ac); l.setIcon(outerTablePanel.visibilityIcons[visibility]); } else if (m.getInternalColumn(modelIndex) == ViperTableModel.BY_VALID) { Config config = m.getConfig(); int visibility = mediator.getHiders().getConfigVisibility(m.getConfig()); if (visibility == NodeVisibilityManager.RANGE_LOCKED) { visibility = NodeVisibilityManager.LOCKED; } l.setIcon(outerTablePanel.visibilityIcons[visibility]); } else { l.setIcon(null); } } return c; }
/** * Closes dialog box when the OK button is pressed, sets variables and calls algorithm. * * @param event Event that triggers function. */ public void actionPerformed(ActionEvent event) { String command = event.getActionCommand(); Object source = event.getSource(); if (command.equals("OK")) { if (setVariables()) { callAlgorithm(); } } else if (command.equals("Cancel")) { dispose(); } else if (command.equals("Help")) { // MipavUtil.showHelp(""); } else if (source.equals(doRicianCheckBox)) { if (doRicianCheckBox.isSelected()) { labelDegree.setEnabled(true); textDegree.setEnabled(true); } else { labelDegree.setEnabled(false); textDegree.setEnabled(false); } } else { // else if (source == thresholdCheckbox) super.actionPerformed(event); } }
private void pageChanged() { switch (currentPage) { case 0: caption.setText("Specify where " + appName + " is to be installed"); nextButton.setText("Next"); prevButton.setEnabled(true); break; case 1: caption.setText("Installing " + appName); nextButton.setText("Finish"); prevButton.setEnabled(false); nextButton.setEnabled(false); install(); break; case 2: caption.setText("Installation complete"); nextButton.setText("Finish"); prevButton.setEnabled(false); nextButton.setEnabled(true); cancelButton.setEnabled(false); break; } getRootPane().invalidate(); getRootPane().validate(); }
public static void main(String[] args) { final JPopupMenu menu = new JPopupMenu(); menu.setLayout(new GridLayout(0, 3, 5, 5)); final MenuedButton button = new MenuedButton("Icons", menu); for (int i = 0; i < 9; i++) { // replace "print.gif" with your own image final JLabel label = new JLabel("" + i); // new ImageIcon("resources/images/print.gif") ); label.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { button.getMainButton().setIcon(label.getIcon()); menu.setVisible(false); } }); menu.add(label); } JFrame frame = new JFrame("Button Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new JLabel("Click Arrow Button To Show Popup"), BorderLayout.NORTH); frame.getContentPane().add(button, BorderLayout.CENTER); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
public void updateHelper() { if (model.GuessORHint == 0) { label1.setText("Entered:"); } if (model.GuessORHint == 1) { label1.setText("Hints:"); } DefaultListModel<String> listTemp = new DefaultListModel<String>(); if (model.GuessORHint == 0) { for (String str : model.haveEntered) { listTemp.addElement(str); } } else { if (model.hintWords != null) { for (String MM : model.hintWords) { if (MM == null) { listTemp.addElement("APPLE"); } else { listTemp.addElement(MM); } } } } list.setModel(listTemp); scroll.setViewportView(list); }