rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
SwingUtilities.calculateInnerArea(scrollbar, trackRect); trackRect.height -= incrDims.getHeight(); trackRect.height -= decrDims.getHeight(); trackRect.y += decrDims.getHeight(); updateThumbRect();
protected void layoutVScrollbar(JScrollBar sb) { Rectangle vr = new Rectangle(); SwingUtilities.calculateInnerArea(scrollbar, vr); // Update rectangles getTrackBounds(); getThumbBounds(); Dimension incrDims = incrButton.getPreferredSize(); Dimension decrDims = decrButton.getPreferredSize(); d...
incrButton = null; decrButton = null;
protected void uninstallComponents() { scrollbar.remove(incrButton); scrollbar.remove(decrButton); incrButton = null; decrButton = null; }
scrollbar.setBorder(null);
LookAndFeel.uninstallBorder(scrollbar); incrButton = null; decrButton = null;
protected void uninstallDefaults() { scrollbar.setForeground(null); scrollbar.setBackground(null); scrollbar.setBorder(null); }
scrollbar.removeMouseListener(trackListener); scrollbar.removeMouseMotionListener(trackListener);
protected void uninstallListeners() { scrollTimer.removeActionListener(scrollListener); scrollbar.getModel().removeChangeListener(modelListener); scrollbar.removePropertyChangeListener(propertyChangeListener); decrButton.removeMouseListener(buttonListener); incrButton.removeMouseListener(buttonListene...
uninstallListeners();
public void uninstallUI(JComponent c) { uninstallDefaults(); uninstallListeners(); uninstallComponents(); scrollTimer = null; thumbRect = null; trackRect = null; trackColor = null; trackHighlightColor = null; thumbColor = null; thumbHighlightColor = null; thumbDarkShadowColor = null;...
invalidateTree ();
setMenuBar(MenuBar menuBar){ if (peer != null) { if (this.menuBar != null) this.menuBar.removeNotify(); if (menuBar != null) menuBar.addNotify(); ((FramePeer) peer).setMenuBar(menuBar); } this.menuBar = menuBar;}
if (value.equals(e.value))
if (e.value.equals(value))
public synchronized boolean contains(Object value) { for (int i = buckets.length - 1; i >= 0; i--) { HashEntry<K, V> e = buckets[i]; while (e != null) { if (value.equals(e.value)) return true; e = e.next; } } // Must throw on null arg...
if (value == null) throw new NullPointerException();
public synchronized boolean contains(Object value) { for (int i = buckets.length - 1; i >= 0; i--) { HashEntry<K, V> e = buckets[i]; while (e != null) { if (value.equals(e.value)) return true; e = e.next; } } // Must throw on null arg...
return new HashIterator<Map.Entry<K, V>>(ENTRIES);
return new EntryIterator();
public Iterator<Map.Entry<K, V>> iterator() { return new HashIterator<Map.Entry<K, V>>(ENTRIES); }
if (o.equals(e))
if (e.equals(o))
HashEntry<K, V> getEntry(Object o) { if (! (o instanceof Map.Entry)) return null; K key = ((Map.Entry<K, V>) o).getKey(); if (key == null) return null; int idx = hash(key); HashEntry<K, V> e = buckets[idx]; while (e != null) { if (o.equals(e)) return e; e = e.n...
return new HashIterator<K>(KEYS);
return new KeyIterator();
public Iterator<K> iterator() { return new HashIterator<K>(KEYS); }
while (dest.next != null) dest = dest.next;
HashEntry next = dest.next; while (next != null) { dest = next; next = dest.next; }
protected void rehash() { HashEntry<K, V>[] oldBuckets = buckets; int newcapacity = (buckets.length * 2) + 1; threshold = (int) (newcapacity * loadFactor); buckets = (HashEntry<K, V>[]) new HashEntry[newcapacity]; for (int i = oldBuckets.length - 1; i >= 0; i--) { HashEntry<K, V> e = oldBu...
return new HashIterator<V>(VALUES);
return new ValueIterator();
public Iterator<V> iterator() { return new HashIterator<V>(VALUES); }
Iterator<Map.Entry<K, V>> it = new HashIterator<Map.Entry<K, V>>(ENTRIES);
Iterator<Map.Entry<K, V>> it = new EntryIterator();
private synchronized void writeObject(ObjectOutputStream s) throws IOException { // Write the threshold and loadFactor fields. s.defaultWriteObject(); s.writeInt(buckets.length); s.writeInt(size); // Since we are already synchronized, and entrySet().iterator() // would repeatedly re-lock/release...
setMaximum(int maximum) { }
public void setMaximum (int maximum) { this.maximum = maximum; }
setMaximum(int maximum){}
setMinimum(int minimum) { }
public void setMinimum (int minimum) { this.minimum = minimum; }
setMinimum(int minimum){}
setVisibleAmount(int visibleAmount) { }
public void setVisibleAmount (int visibleAmount) { this.visibleAmount = visibleAmount; }
setVisibleAmount(int visibleAmount){}
/* else if (tag.equals(HTML.Tag.CONTENT))
else if (tag.equals(HTML.Tag.CONTENT))
public View create(Element element) { View view = null; Object attr = element.getAttributes().getAttribute( StyleConstants.NameAttribute); if (attr instanceof HTML.Tag) { HTML.Tag tag = (HTML.Tag) attr; if (tag.equals(HTML.Tag.IMPLIED) || tag...
/*
public View create(Element element) { View view = null; Object attr = element.getAttributes().getAttribute( StyleConstants.NameAttribute); if (attr instanceof HTML.Tag) { HTML.Tag tag = (HTML.Tag) attr; if (tag.equals(HTML.Tag.IMPLIED) || tag...
if (Configuration.DEBUG)
Parser getParser() { log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$ Parser result = new ClasspathToolParser(Main.DELETE_CMD, true); result.setHeader(Messages.getString("DeleteCmd.18")); //$NON-NLS-1$ result.setFooter(Messages.getString("DeleteCmd.17")); //$NON-NLS-1$ OptionGroup o...
log.finer("-delete handler will use the following options:"); log.finer(" -alias=" + alias); log.finer(" -storetype=" + storeType); log.finer(" -keystore=" + storeURL); log.finer(" -provider=" + provider); log.finer(" -v=" + verbose);
if (Configuration.DEBUG) { log.fine("-delete handler will use the following options:"); log.fine(" -alias=" + alias); log.fine(" -storetype=" + storeType); log.fine(" -keystore=" + storeURL); log.fine(" -provider=" + provider); log.fine(" -v=" + verbose); }
void setup() throws Exception { setKeyStoreParams(_providerClassName, _ksType, _ksPassword, _ksURL); setTheAlias(_alias); log.finer("-delete handler will use the following options:"); //$NON-NLS-1$ log.finer(" -alias=" + alias); //$NON-NLS-1$ log.finer(" -storetype=" + storeType); //$NON-NLS-1$ l...
if (Configuration.DEBUG)
void start() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$ ensureStoreContainsAlias(); store.deleteEntry(alias); saveKeyStore(); log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$...
index = -1; fireStateChanged();
setSelectedIndex(-1);
public void clearSelection() { index = -1; fireStateChanged(); }
}
public void setSelectedIndex(int index) { this.index = index; fireStateChanged(); }
setScrollMode(BLIT_SCROLL_MODE);
public JViewport() { setOpaque(true); updateUI(); }
"List.focusCellHighlightBorder", new BorderUIResource. LineBorderUIResource(new ColorUIResource(Color.yellow)),
protected void initComponentDefaults(UIDefaults defaults) { Object[] uiDefaults; Color highLight = new Color(249, 247, 246); Color light = new Color(239, 235, 231); Color shadow = new Color(139, 136, 134); Color darkShadow = new Color(16, 16, 16); uiDefaults = new Object[] { "AbstractUndoa...
JViewport v = (JViewport)c; Component view = v.getView();
JViewport port = (JViewport)c; Component view = port.getView();
public void paint(Graphics g, JComponent c) { JViewport v = (JViewport)c; Component view = v.getView(); if (view == null) return; Point pos = v.getViewPosition(); Rectangle viewBounds = view.getBounds(); Rectangle portBounds = v.getBounds(); if (viewBounds.width == 0 || viewBo...
Point pos = v.getViewPosition();
Point pos = port.getViewPosition();
public void paint(Graphics g, JComponent c) { JViewport v = (JViewport)c; Component view = v.getView(); if (view == null) return; Point pos = v.getViewPosition(); Rectangle viewBounds = view.getBounds(); Rectangle portBounds = v.getBounds(); if (viewBounds.width == 0 || viewBo...
Rectangle portBounds = v.getBounds();
Rectangle portBounds = port.getBounds();
public void paint(Graphics g, JComponent c) { JViewport v = (JViewport)c; Component view = v.getView(); if (view == null) return; Point pos = v.getViewPosition(); Rectangle viewBounds = view.getBounds(); Rectangle portBounds = v.getBounds(); if (viewBounds.width == 0 || viewBo...
if (backingStoreImage == null || backingStoreWidth != viewBounds.width || backingStoreHeight != viewBounds.height)
switch (port.getScrollMode())
public void paint(Graphics g, JComponent c) { JViewport v = (JViewport)c; Component view = v.getView(); if (view == null) return; Point pos = v.getViewPosition(); Rectangle viewBounds = view.getBounds(); Rectangle portBounds = v.getBounds(); if (viewBounds.width == 0 || viewBo...
backingStoreImage = v.createImage(viewBounds.width, viewBounds.height); backingStoreWidth = viewBounds.width; backingStoreHeight = viewBounds.height;
case JViewport.BACKINGSTORE_SCROLL_MODE: paintBackingStore(g, port, view, pos, viewBounds, portBounds); break; case JViewport.BLIT_SCROLL_MODE: case JViewport.SIMPLE_SCROLL_MODE: default: paintSimple(g, port, view, pos, viewBounds, portBounds); break;
public void paint(Graphics g, JComponent c) { JViewport v = (JViewport)c; Component view = v.getView(); if (view == null) return; Point pos = v.getViewPosition(); Rectangle viewBounds = view.getBounds(); Rectangle portBounds = v.getBounds(); if (viewBounds.width == 0 || viewBo...
Graphics g2 = backingStoreImage.getGraphics(); if (c.getBackground() != null) { java.awt.Color save = g2.getColor(); g2.setColor(c.getBackground()); g2.fillRect (0, 0, backingStoreWidth, backingStoreHeight); g2.setColor(save); save = g.getColor(); g.setColor(c.getBackground()); g.fillRect (0, 0, portBounds.width, ...
public void paint(Graphics g, JComponent c) { JViewport v = (JViewport)c; Component view = v.getView(); if (view == null) return; Point pos = v.getViewPosition(); Rectangle viewBounds = view.getBounds(); Rectangle portBounds = v.getBounds(); if (viewBounds.width == 0 || viewBo...
abstractDataInputStream din;
AbstractDataInput din;
public void read(java.io.InputStream istream) throws MARSHAL { try { byte[] xMagic = new byte[ MAGIC.length ]; istream.read(xMagic); if (!Arrays.equals(xMagic, MAGIC)) { MARSHAL m = new MARSHAL("Not a GIOP message"); m.minor = Minor.Giop; ...
abstractDataOutputStream dout;
AbstractDataOutput dout;
public void write(java.io.OutputStream out) { try { abstractDataOutputStream dout; if (isBigEndian()) dout = new BigEndianOutputStream(out); else dout = new LittleEndianOutputStream(out); // Write magic sequence. dout.write(MAGIC); // Write version ...
Rectangle vr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle();
public Dimension getPreferredSize(JComponent c) { JLabel lab = (JLabel) c; Rectangle vr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); Insets insets = lab.getInsets(); FontMetrics fm = lab.getFontMetrics(lab.getFont()); layoutCL(lab, fm, lab.getText(), ...
Rectangle cr = tr.union(ir);
Rectangle cr = SwingUtilities.computeUnion(tr.x, tr.y, tr.width, tr.height, ir);
public Dimension getPreferredSize(JComponent c) { JLabel lab = (JLabel) c; Rectangle vr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); Insets insets = lab.getInsets(); FontMetrics fm = lab.getFontMetrics(lab.getFont()); layoutCL(lab, fm, lab.getText(), ...
BasicHTML.updateRenderer(c, c.getText());
protected void installComponents(JLabel c) { //FIXME: fix javadoc + implement. }
Rectangle tr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle vr = new Rectangle();
public void paint(Graphics g, JComponent c) { JLabel b = (JLabel) c; Rectangle tr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle vr = new Rectangle(); FontMetrics fm = g.getFontMetrics(); vr = SwingUtilities.calculateInnerArea(c, vr); if (vr.width < 0) vr.width = 0; if (vr....
else { ((View) htmlRenderer).paint(g, tr); } }
public void paint(Graphics g, JComponent c) { JLabel b = (JLabel) c; Rectangle tr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle vr = new Rectangle(); FontMetrics fm = g.getFontMetrics(); vr = SwingUtilities.calculateInnerArea(c, vr); if (vr.width < 0) vr.width = 0; if (vr....
if (e.getPropertyName().equals("text")) { String text = (String) e.getNewValue(); JLabel l = (JLabel) e.getSource(); BasicHTML.updateRenderer(l, text); }
public void propertyChange(PropertyChangeEvent e) { // What to do here? }
c.putClientProperty(BasicHTML.propertyKey, null); c.putClientProperty(BasicHTML.documentBaseKey, null);
protected void uninstallComponents(JLabel c) { //FIXME: fix javadoc + implement. }
public IllegalAccessException() { super(); }
public IllegalAccessException() { }
public IllegalAccessException() { super(); }
if (component instanceof AbstractButton) { AbstractButton b = (AbstractButton) component; b.setRolloverEnabled(rollover); b.updateUI(); }
protected void addImpl(Component component, Object constraints, int index) { // XXX: Sun says disable button but test cases show otherwise. super.addImpl(component, constraints, index); } // addImpl()
public synchronized void addTextListener(TextListener listener) {
addTextListener(TextListener listener) {
public synchronized void addTextListener(TextListener listener) { textListener = AWTEventMulticaster.add(textListener, listener); enableEvents(AWTEvent.TEXT_EVENT_MASK); }
public synchronized int getCaretPosition() { TextComponentPeer tcp = (TextComponentPeer) getPeer();
getCaretPosition() { TextComponentPeer tcp = (TextComponentPeer)getPeer();
public synchronized int getCaretPosition() { TextComponentPeer tcp = (TextComponentPeer) getPeer(); if (tcp != null) return (tcp.getCaretPosition()); else return (0); }
public synchronized String getSelectedText() {
getSelectedText() {
public synchronized String getSelectedText() { String alltext = getText(); int start = getSelectionStart(); int end = getSelectionEnd(); return (alltext.substring(start, end)); }
protected void processTextEvent(TextEvent event) {
processTextEvent(TextEvent event) {
protected void processTextEvent(TextEvent event) { if (textListener != null) textListener.textValueChanged(event); }
public synchronized void removeTextListener(TextListener listener) {
removeTextListener(TextListener listener) {
public synchronized void removeTextListener(TextListener listener) { textListener = AWTEventMulticaster.remove(textListener, listener); }
public synchronized void select(int selectionStart, int endSelection) {
select(int selectionStart, int selectionEnd) {
public synchronized void select(int selectionStart, int endSelection) { if (selectionStart < 0) selectionStart = 0; if (selectionStart > getText().length()) selectionStart = text.length(); if (selectionEnd > text.length()) selectionEnd = text.length(); if (selectionStart > getSelectionEnd()) selectionStart...
this.selectionEnd = endSelection;
this.selectionEnd = selectionEnd;
public synchronized void select(int selectionStart, int endSelection) { if (selectionStart < 0) selectionStart = 0; if (selectionStart > getText().length()) selectionStart = text.length(); if (selectionEnd > text.length()) selectionEnd = text.length(); if (selectionStart > getSelectionEnd()) selectionStart...
public synchronized void selectAll() {
selectAll() {
public synchronized void selectAll() { select(0, getText().length()); }
public synchronized void setCaretPosition(int caretPosition) {
setCaretPosition(int caretPosition) {
public synchronized void setCaretPosition(int caretPosition) { if (caretPosition < 0) throw new IllegalArgumentException(); TextComponentPeer tcp = (TextComponentPeer) getPeer(); if (tcp != null) tcp.setCaretPosition(caretPosition); }
public synchronized void setEditable(boolean editable) {
setEditable(boolean editable) {
public synchronized void setEditable(boolean editable) { this.editable = editable; TextComponentPeer tcp = (TextComponentPeer) getPeer(); if (tcp != null) tcp.setEditable(editable); }
public synchronized void setSelectionEnd(int selectionEnd) {
setSelectionEnd(int selectionEnd) {
public synchronized void setSelectionEnd(int selectionEnd) { select(getSelectionStart(), selectionEnd); }
public synchronized void setSelectionStart(int selectionStart) {
setSelectionStart(int selectionStart) {
public synchronized void setSelectionStart(int selectionStart) { select(selectionStart, getSelectionEnd()); }
log.entering("DSSKeyPairPKCS8Codec", "decodePrivateKey");
if (Configuration.DEBUG) log.entering(this.getClass().getName(), "decodePrivateKey");
public PrivateKey decodePrivateKey(byte[] input) { log.entering("DSSKeyPairPKCS8Codec", "decodePrivateKey"); if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, p, q, g, x; DERReader der = new DERReader(input); try { DERValue der...
log.finest("val = " + val);
if (Configuration.DEBUG) log.fine("val = " + val);
public PrivateKey decodePrivateKey(byte[] input) { log.entering("DSSKeyPairPKCS8Codec", "decodePrivateKey"); if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, p, q, g, x; DERReader der = new DERReader(input); try { DERValue der...
log.finest(Util.dumpString(xBytes, "xBytes: "));
if (Configuration.DEBUG) log.fine(Util.dumpString(xBytes, "xBytes: "));
public PrivateKey decodePrivateKey(byte[] input) { log.entering("DSSKeyPairPKCS8Codec", "decodePrivateKey"); if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, p, q, g, x; DERReader der = new DERReader(input); try { DERValue der...
InvalidParameterException y = new InvalidParameterException();
InvalidParameterException y = new InvalidParameterException(e.getMessage());
public PrivateKey decodePrivateKey(byte[] input) { log.entering("DSSKeyPairPKCS8Codec", "decodePrivateKey"); if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, p, q, g, x; DERReader der = new DERReader(input); try { DERValue der...
log.exiting("DSSKeyPairPKCS8Codec", "decodePrivateKey");
if (Configuration.DEBUG) log.exiting(this.getClass().getName(), "decodePrivateKey");
public PrivateKey decodePrivateKey(byte[] input) { log.entering("DSSKeyPairPKCS8Codec", "decodePrivateKey"); if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, p, q, g, x; DERReader der = new DERReader(input); try { DERValue der...
InvalidParameterException y = new InvalidParameterException();
InvalidParameterException y = new InvalidParameterException(e.getMessage());
public byte[] encodePrivateKey(PrivateKey key) { if (! (key instanceof DSSPrivateKey)) throw new InvalidParameterException("Wrong key type"); DERValue derVersion = new DERValue(DER.INTEGER, BigInteger.ZERO); DERValue derOID = new DERValue(DER.OBJECT_IDENTIFIER, DSA_ALG_OID); DSSPrivateKey pk = (DSSP...
return getEncoded(IKeyPairCodec.RAW_FORMAT);
byte[] result; switch (format) { case IKeyPairCodec.RAW_FORMAT: result = new DHKeyPairRawCodec().encodePublicKey(this); break; case IKeyPairCodec.X509_FORMAT: result = new DHKeyPairX509Codec().encodePublicKey(this); break; default: throw new IllegalArgumentException("Unsupported encoding format: " + format); } return r...
public byte[] getEncoded() { return getEncoded(IKeyPairCodec.RAW_FORMAT); }
IKeyPairCodec codec = new DHKeyPairRawCodec(); return (GnuDHPublicKey) codec.decodePublicKey(k);
return (GnuDHPublicKey) new DHKeyPairRawCodec().decodePublicKey(k);
public static GnuDHPublicKey valueOf(byte[] k) { // check magic... // we should parse here enough bytes to know which codec to use, and // direct the byte array to the appropriate codec. since we only have one // codec, we could have immediately tried it; nevertheless since testing // one byte is che...
else
catch (IllegalArgumentException ignored)
public static GnuDHPublicKey valueOf(byte[] k) { // check magic... // we should parse here enough bytes to know which codec to use, and // direct the byte array to the appropriate codec. since we only have one // codec, we could have immediately tried it; nevertheless since testing // one byte is che...
throw new IllegalArgumentException("magic");
public static GnuDHPublicKey valueOf(byte[] k) { // check magic... // we should parse here enough bytes to know which codec to use, and // direct the byte array to the appropriate codec. since we only have one // codec, we could have immediately tried it; nevertheless since testing // one byte is che...
return (GnuDHPublicKey) new DHKeyPairX509Codec().decodePublicKey(k);
public static GnuDHPublicKey valueOf(byte[] k) { // check magic... // we should parse here enough bytes to know which codec to use, and // direct the byte array to the appropriate codec. since we only have one // codec, we could have immediately tried it; nevertheless since testing // one byte is che...
int arrowSize = comboBox.getHeight();
Insets i = getInsets(); int arrowSize = comboBox.getHeight() - (i.top + i.bottom);
public void layoutContainer(Container parent) { // Position editor component to the left of arrow button if combo box is // editable int arrowSize = comboBox.getHeight(); int editorWidth = comboBox.getBounds().width - arrowSize; if (comboBox.isEditable()) editor.setBounds(0, 0, e...
if (comboBox.isEditable()) editor.setBounds(0, 0, editorWidth, comboBox.getBounds().height);
if (editor != null) editor.setBounds(rectangleForCurrentValue());
public void layoutContainer(Container parent) { // Position editor component to the left of arrow button if combo box is // editable int arrowSize = comboBox.getHeight(); int editorWidth = comboBox.getBounds().width - arrowSize; if (comboBox.isEditable()) editor.setBounds(0, 0, e...
arrowButton.setBounds(editorWidth, 0, arrowSize, arrowSize); comboBox.revalidate();
if (arrowButton != null) arrowButton.setBounds(comboBox.getWidth() - (i.right + arrowSize), i.top, arrowSize, arrowSize);
public void layoutContainer(Container parent) { // Position editor component to the left of arrow button if combo box is // editable int arrowSize = comboBox.getHeight(); int editorWidth = comboBox.getBounds().width - arrowSize; if (comboBox.isEditable()) editor.setBounds(0, 0, e...
return preferredLayoutSize(parent);
return parent.getMinimumSize();
public Dimension minimumLayoutSize(Container parent) { return preferredLayoutSize(parent); }
return getPreferredSize((JComponent) parent);
return parent.getPreferredSize();
public Dimension preferredLayoutSize(Container parent) { return getPreferredSize((JComponent) parent); }
isMinimumSizeDirty = true;
public void focusGained(FocusEvent e) { // Lets assume every change invalidates the minimumsize. isMinimumSizeDirty = true; hasFocus = true; comboBox.repaint(); }
isMinimumSizeDirty = true;
public void focusLost(FocusEvent e) { // Lets assume every change invalidates the minimumsize. isMinimumSizeDirty = true; hasFocus = false; setPopupVisible(comboBox, false); comboBox.repaint(); }
if (! e.isTemporary() && comboBox.isLightWeightPopupEnabled())
public void focusLost(FocusEvent e) { // Lets assume every change invalidates the minimumsize. isMinimumSizeDirty = true; hasFocus = false; setPopupVisible(comboBox, false); comboBox.repaint(); }
isMinimumSizeDirty = true; if (e.getStateChange() == ItemEvent.SELECTED && comboBox.isEditable()) comboBox.getEditor().setItem(e.getItem());
ComboBoxModel model = comboBox.getModel(); Object v = model.getSelectedItem(); if (editor != null) { comboBox.configureEditor(comboBox.getEditor(), v); }
public void itemStateChanged(ItemEvent e) { // Lets assume every change invalidates the minimumsize. isMinimumSizeDirty = true; if (e.getStateChange() == ItemEvent.SELECTED && comboBox.isEditable()) comboBox.getEditor().setItem(e.getItem()); comboBox.repaint(); }
if (e.getIndex0() != -1 || e.getIndex1() != -1) {
public void contentsChanged(ListDataEvent e) { // if the item is selected or deselected // Lets assume every change invalidates the minimumsize. isMinimumSizeDirty = true; }
comboBox.revalidate(); } if (editor != null) { comboBox.configureEditor(comboBox.getEditor(), comboBox.getSelectedItem()); } comboBox.repaint();
public void contentsChanged(ListDataEvent e) { // if the item is selected or deselected // Lets assume every change invalidates the minimumsize. isMinimumSizeDirty = true; }
isMinimumSizeDirty = true;
int start = e.getIndex0(); int end = e.getIndex1(); if (start == 0 && comboBox.getItemCount() - (end - start + 1) == 0) { contentsChanged(e); } else if (start != -1 || end != -1) { ListCellRenderer renderer = comboBox.getRenderer(); ComboBoxModel model = comboBox.getModel(); int w = displaySize.width; int h = displayS...
public void intervalAdded(ListDataEvent e) { // Lets assume every change invalidates the minimumsize. isMinimumSizeDirty = true; ComboBoxModel model = comboBox.getModel(); ListCellRenderer renderer = comboBox.getRenderer(); if (displaySize == null) displaySize = getDisplaySize(); ...
ComboBoxModel model = comboBox.getModel(); ListCellRenderer renderer = comboBox.getRenderer(); if (displaySize == null) displaySize = getDisplaySize(); if (displaySize.width < getDefaultSize().width) displaySize.width = getDefaultSize().width; if (displaySize.height < getDefaultSize().height) displaySize.height = getD...
public void intervalAdded(ListDataEvent e) { // Lets assume every change invalidates the minimumsize. isMinimumSizeDirty = true; ComboBoxModel model = comboBox.getModel(); ListCellRenderer renderer = comboBox.getRenderer(); if (displaySize == null) displaySize = getDisplaySize(); ...
isMinimumSizeDirty = true; displaySize = getDisplaySize(); comboBox.repaint();
contentsChanged(e);
public void intervalRemoved(ListDataEvent e) { // Lets assume every change invalidates the minimumsize. isMinimumSizeDirty = true; // recalculate display size of the JComboBox. displaySize = getDisplaySize(); comboBox.repaint(); }
currentValuePane = new CellRendererPane(); cachedMinimumSize = new Dimension();
public BasicComboBoxUI() { // Nothing to do here. }
removeEditor(); editor = comboBox.getEditor().getEditorComponent();
public void addEditor() { comboBox.add(editor); }
arrowButton.setFont(comboBox.getFont());
public void configureArrowButton() { arrowButton.setEnabled(comboBox.isEnabled()); arrowButton.setFont(comboBox.getFont()); arrowButton.setFocusable(false); }
if (popupMouseListener != null) arrowButton.addMouseListener(popupMouseListener); if (popupMouseMotionListener != null) arrowButton.addMouseMotionListener(popupMouseMotionListener); }
public void configureArrowButton() { arrowButton.setEnabled(comboBox.isEnabled()); arrowButton.setFont(comboBox.getFont()); arrowButton.setFocusable(false); }
comboBox.getEditor().setItem(comboBox.getSelectedItem());
if (popupKeyListener != null) editor.addKeyListener(popupKeyListener); comboBox.configureEditor(comboBox.getEditor(), comboBox.getSelectedItem());
protected void configureEditor() { editor.setFont(comboBox.getFont()); comboBox.getEditor().setItem(comboBox.getSelectedItem()); // FIXME: Need to implement. Set font and add listeners. }
return new BasicArrowButton(BasicArrowButton.SOUTH, buttonBackground, buttonShadow, buttonDarkShadow, buttonHighlight);
return new BasicArrowButton(BasicArrowButton.SOUTH);
protected JButton createArrowButton() { return new BasicArrowButton(BasicArrowButton.SOUTH, buttonBackground, buttonShadow, buttonDarkShadow, buttonHighlight); }
return new BasicComboBoxRenderer();
return new BasicComboBoxRenderer.UIResource();
protected ListCellRenderer createRenderer() { return new BasicComboBoxRenderer(); }
FontMetrics fm = comboBox.getFontMetrics(comboBox.getFont()); int w = fm.charWidth(' ') + 2; int h = fm.getHeight() + 2; return new Dimension(w, h);
Component comp = DEFAULT_RENDERER.getListCellRendererComponent(listBox, " ", -1, false, false); currentValuePane.add(comp); comp.setFont(comboBox.getFont()); int h = comp.getPreferredSize().height; currentValuePane.remove(comp); return new Dimension(100, h);
protected Dimension getDefaultSize() { // There is nothing in the spec to say how this method should be // implemented...so I've done some guessing, written some Mauve tests, // and written something that gives dimensions that are close to the // reference implementation. FontMetrics fm = comboBox.ge...
if (!comboBox.isEditable())
if (comboBox.isEditable() && comboBox.getModel().getSize() == 0) return new Dimension(100, editor.getPreferredSize().height); Dimension dim = new Dimension(); ListCellRenderer renderer = comboBox.getRenderer(); ComboBoxModel model = comboBox.getModel(); if (renderer != null && model.getSize() > 0)
protected Dimension getDisplaySize() { if (!comboBox.isEditable()) { Object prototype = comboBox.getPrototypeDisplayValue(); if (prototype != null) { // calculate result based on prototype ListCellRenderer renderer = comboBox.getRenderer(); Component comp = renderer.getListCe...
Object prototype = comboBox.getPrototypeDisplayValue(); if (prototype != null) { ListCellRenderer renderer = comboBox.getRenderer(); Component comp = renderer.getListCellRendererComponent(listBox, prototype, -1, false, false); Dimension compSize = comp.getPreferredSize(); compSize.width += 2; compSize.height += 2; ret...
int size = model.getSize(); for (int i = 0; i < size; ++i) { Component comp = renderer.getListCellRendererComponent (listBox, model.getElementAt(i), -1, false, false); currentValuePane.add(comp); comp.setFont(comboBox.getFont()); Dimension renderSize = comp.getPreferredSize(); currentValuePane.remove(comp); dim.width =...
protected Dimension getDisplaySize() { if (!comboBox.isEditable()) { Object prototype = comboBox.getPrototypeDisplayValue(); if (prototype != null) { // calculate result based on prototype ListCellRenderer renderer = comboBox.getRenderer(); Component comp = renderer.getListCe...
} else { Component comp = comboBox.getEditor().getEditorComponent(); Dimension prefSize = comp.getPreferredSize(); int width = prefSize.width; int height = prefSize.height + 2; Object prototype = comboBox.getPrototypeDisplayValue(); if (prototype != null)
if (comboBox.isEditable())
protected Dimension getDisplaySize() { if (!comboBox.isEditable()) { Object prototype = comboBox.getPrototypeDisplayValue(); if (prototype != null) { // calculate result based on prototype ListCellRenderer renderer = comboBox.getRenderer(); Component comp = renderer.getListCe...
FontMetrics fm = comboBox.getFontMetrics(comboBox.getFont()); width = Math.max(width, fm.stringWidth(prototype.toString()) + 2);
Dimension editSize = editor.getPreferredSize(); dim.width = Math.max(dim.width, editSize.width); dim.height = Math.max(dim.height, editSize.height);
protected Dimension getDisplaySize() { if (!comboBox.isEditable()) { Object prototype = comboBox.getPrototypeDisplayValue(); if (prototype != null) { // calculate result based on prototype ListCellRenderer renderer = comboBox.getRenderer(); Component comp = renderer.getListCe...
displaySize = new Dimension(width, height);
displaySize.setSize(dim.width, dim.height);
protected Dimension getDisplaySize() { if (!comboBox.isEditable()) { Object prototype = comboBox.getPrototypeDisplayValue(); if (prototype != null) { // calculate result based on prototype ListCellRenderer renderer = comboBox.getRenderer(); Component comp = renderer.getListCe...
return getDefaultSize();
protected Dimension getDisplaySize() { if (!comboBox.isEditable()) { Object prototype = comboBox.getPrototypeDisplayValue(); if (prototype != null) { // calculate result based on prototype ListCellRenderer renderer = comboBox.getRenderer(); Component comp = renderer.getListCe...
return new Insets(0, 0, 0, 0);
return comboBox.getInsets();
protected Insets getInsets() { return new Insets(0, 0, 0, 0); }
return MAXIMUM_SIZE;
Dimension size = getPreferredSize(c); size.width = 32767; return size;
public Dimension getMaximumSize(JComponent c) { return MAXIMUM_SIZE; }
int arrowButtonWidth = d.height; cachedMinimumSize = new Dimension(d.width + arrowButtonWidth, d.height);
d.height += i.top + i.bottom; int arrowButtonWidth = d.height - (i.top + i.bottom); cachedMinimumSize = new Dimension(d.width + arrowButtonWidth + i.left + i.right, d.height);
public Dimension getMinimumSize(JComponent c) { if (isMinimumSizeDirty) { Dimension d = getDisplaySize(); int arrowButtonWidth = d.height; cachedMinimumSize = new Dimension(d.width + arrowButtonWidth, d.height); isMinimumSizeDirty = false; } return new Dimension(cachedMinimumSize); }
return getMinimumSize(c);
Dimension size = getMinimumSize(c); size.width += 4; return size;
public Dimension getPreferredSize(JComponent c) { // note: overriding getMinimumSize() (for example in the MetalComboBoxUI // class) affects the getPreferredSize() result, so it seems logical that // this method is implemented by delegating to the getMinimumSize() method return getMinimumSize(c); }
comboBox.setRenderer(createRenderer());
protected void installComponents() { // create drop down list of items popup = createPopup(); listBox = popup.getList(); // set editor and renderer for the combo box. Editor is used // only if combo box becomes editable, otherwise renderer is used // to paint the selected item; combobox is not edit...
configureArrowButton();
protected void installComponents() { // create drop down list of items popup = createPopup(); listBox = popup.getList(); // set editor and renderer for the combo box. Editor is used // only if combo box becomes editable, otherwise renderer is used // to paint the selected item; combobox is not edit...