public Dimension getPreferredSize() { int w = 0; int h = 0; Graphics g = PropUtils.getScratchGraphics(this); FontMetrics fm = g.getFontMetrics(getFont()); if (getIcon() != null) { w = getIcon().getIconWidth(); h = getIcon().getIconHeight(); } if (getBorder() != null) { Insets ins = getBorder().getBorderInsets(this); w+=ins.left + ins.right; h+=ins.bottom+ins.top; } w += fm.stringWidth(getText()) + 22; h = Math.max(fm.getHeight(), h) + 2; return new Dimension(w,h); } }
private InvRadioButton[] getButtons(int count) { InvRadioButton[] result = new InvRadioButton[count]; Iterator i = buttonCache.iterator(); int idx=0; while (i.hasNext() && idx < count) { result[idx] = (InvRadioButton) i.next(); if (result[idx] != null) { result[idx].setEnabled(true); result[idx].setSelected(false); idx++; } } for (;idx < count; idx++) { result[idx] = createButton(); buttonCache.add(result[idx]); } return result; }
/** Renderer version overrides this */ protected void configureButton (InvRadioButton ire, String txt) { ire.addActionListener(this); if (editor.getTags().length == 1) { ire.setEnabled(false); } else { ire.setEnabled(isEnabled()); } if (tableUI) { ire.setFocusable(false); } else { ire.setFocusable(true); } ire.setText(txt); if (txt.equals(editor.getAsText())) { ire.setSelected(true); } else { ire.setSelected(false); } ire.setFont(getFont()); ire.setBackground(getBackground()); ire.setForeground(getForeground()); group.add(ire); }
/** Renderer version overrides this */ protected void configureButton (InvRadioButton ire, String txt) { ire.addActionListener(this); if (editor.getTags().length == 1) { ire.setEnabled(false); } else { ire.setEnabled(isEnabled()); } if (tableUI) { ire.setFocusable(false); } else { ire.setFocusable(true); } ire.setText(txt); if (txt.equals(editor.getAsText())) { ire.setSelected(true); } else { ire.setSelected(false); } ire.setFont(getFont()); ire.setBackground(getBackground()); ire.setForeground(getForeground()); group.add(ire); }
/** Renderer version overrides this */ protected void configureButton(InvRadioButton ire, String txt) { ire.addActionListener(this); if (editor.getTags().length == 1) { ire.setEnabled(false); } else { ire.setEnabled(isEnabled()); } if (tableUI) { ire.setFocusable(false); } else { ire.setFocusable(true); } ire.setText(txt); if (txt.equals(editor.getAsText())) { ire.setSelected(true); } else { ire.setSelected(false); } ire.setFont(getFont()); ire.setBackground(getBackground()); ire.setForeground(getForeground()); group.add(ire); }
/** In 1.4, panels can and will receive focus; if we define our own * focus policy, we're responsible for all possible subcomponents. * Therfore just proxy requestFocusInWindow for the selected radio * button */ public void requestFocus() { Component[] c = getComponents(); if (c.length > 0) { for (int i=0; i < c.length; i++) { if (c[i] instanceof InvRadioButton && ((InvRadioButton) c[i]).isSelected()) { c[i].requestFocus(); return; } } c[0].requestFocus(); } else { super.requestFocus(); } }
/** In 1.4, panels can and will receive focus; if we define our own * focus policy, we're responsible for all possible subcomponents. * Therfore just proxy requestFocusInWindow for the selected radio * button */ public void requestFocus() { Component[] c = getComponents(); if (c.length > 0) { for (int i=0; i < c.length; i++) { if (c[i] instanceof InvRadioButton && ((InvRadioButton) c[i]).isSelected()) { c[i].requestFocus(); return; } } c[0].requestFocus(); } else { super.requestFocus(); } }
public Dimension getPreferredSize() { int w = 0; int h = 0; Graphics g = PropUtils.getScratchGraphics(this); FontMetrics fm = g.getFontMetrics(getFont()); if (getIcon() != null) { w = getIcon().getIconWidth(); h = getIcon().getIconHeight(); } if (getBorder() != null) { Insets ins = getBorder().getBorderInsets(this); w+=ins.left + ins.right; h+=ins.bottom+ins.top; } w += fm.stringWidth(getText()) + 22; h = Math.max(fm.getHeight(), h) + 2; return new Dimension(w,h); } }
/** In 1.4, panels can and will receive focus; if we define our own * focus policy, we're responsible for all possible subcomponents. * Therfore just proxy requestFocusInWindow for the selected radio * button */ public void requestFocus() { Component[] c = getComponents(); if (c.length > 0) { for (int i = 0; i < c.length; i++) { if (c[i] instanceof InvRadioButton && ((InvRadioButton) c[i]).isSelected()) { c[i].requestFocus(); return; } } c[0].requestFocus(); } else { super.requestFocus(); } }
private InvRadioButton[] getButtons(int count) { InvRadioButton[] result = new InvRadioButton[count]; Iterator<InvRadioButton> i = buttonCache.iterator(); int idx = 0; while (i.hasNext() && (idx < count)) { result[idx] = i.next(); if (result[idx] != null) { result[idx].setEnabled(true); result[idx].setSelected(false); idx++; } } for (; idx < count; idx++) { result[idx] = createButton(); buttonCache.add(result[idx]); } return result; }
/** Renderer version overrides this */ protected void configureButton (InvRadioButton ire, String txt) { if (editor.getTags().length == 1) { ire.setEnabled(false); } else { ire.setEnabled(isEnabled()); } ire.setText(txt); ire.setForeground(getForeground()); ire.setBackground(getBackground()); ire.setFont(getFont()); if (txt.equals(editor.getAsText())) { ire.setSelected(true); } else { ire.setSelected(false); } }
/** Renderer version overrides this */ protected void configureButton (InvRadioButton ire, String txt) { if (editor.getTags().length == 1) { ire.setEnabled(false); } else { ire.setEnabled(isEnabled()); } ire.setText(txt); ire.setForeground(getForeground()); ire.setBackground(getBackground()); ire.setFont(getFont()); if (txt.equals(editor.getAsText())) { ire.setSelected(true); } else { ire.setSelected(false); } }
private InvRadioButton[] getButtons(int count) { InvRadioButton[] result = new InvRadioButton[count]; Iterator i = buttonCache.iterator(); int idx=0; while (i.hasNext() && idx < count) { result[idx] = (InvRadioButton) i.next(); if (result[idx] != null) { result[idx].setEnabled(true); result[idx].setSelected(false); idx++; } } for (;idx < count; idx++) { result[idx] = createButton(); buttonCache.add(result[idx]); } return result; }
public Dimension getPreferredSize() { int w = 0; int h = 0; Graphics g = PropUtils.getScratchGraphics(this); FontMetrics fm = g.getFontMetrics(getFont()); if (getIcon() != null) { w = getIcon().getIconWidth(); h = getIcon().getIconHeight(); } if (getBorder() != null) { Insets ins = getBorder().getBorderInsets(this); w += (ins.left + ins.right); h += (ins.bottom + ins.top); } w += (fm.stringWidth(getText()) + 22); h = Math.max(fm.getHeight(), h) + 2; return new Dimension(w, h); } }
/** Renderer version overrides this */ protected void configureButton(InvRadioButton ire, String txt) { if (editor.getTags().length == 1) { ire.setEnabled(false); } else { ire.setEnabled(isEnabled()); } ire.setText(txt); ire.setForeground(getForeground()); ire.setBackground(getBackground()); ire.setFont(getFont()); if (txt.equals(editor.getAsText())) { ire.setSelected(true); } else { ire.setSelected(false); } }
public String getName() { return "InvRadioButton - " + getText(); //NOI18N }
public String getName() { return "InvRadioButton - " + getText(); //NOI18N }
public String getName() { return "InvRadioButton - " + getText(); //NOI18N }
/** Renderer version overrides this to create a subclass that won't * fire changes */ protected InvRadioButton createButton() { return new InvRadioButton(); }
public boolean requestFocusInWindow() { Component[] c = getComponents(); for (int i=0; i < c.length; i++) { if (c[i] instanceof InvRadioButton && ((InvRadioButton) c[i]).isSelected()) { return c[i].requestFocusInWindow(); } } return super.requestFocusInWindow(); }