public void paintComponent (Graphics g) { //For property panel usage, allow the editor to paint if (editor != null && !hasFocus() && editor.isPaintable()) { Insets ins = getInsets(); Color c = g.getColor(); try { g.setColor(getBackground()); g.fillRect(0,0,getWidth(),getHeight()); } finally { g.setColor(c); } ins.left += PropUtils.getTextMargin(); editor.paintValue(g, new Rectangle(ins.left, ins.top, getWidth() - (ins.right + ins.left), getHeight() - (ins.top + ins.bottom))); } else { super.paintComponent(g); } }
/** Overridden to return the combo box's background color if selected * and focused - in GTK L&F combo boxes are always white (there's even * a "fixme" note in the code. */ public Color getBackground() { //This method can be called in the superclass constructor, thanks //to updateUI(). At that time, this==null, so an NPE would happen //if we tried tor reference the outer class if (ComboInplaceEditor.this == null) { return null; } if (!sel && (getText() != null && getSelectedItem() != null && getText().equals(getSelectedItem()))) { return ComboInplaceEditor.this.getBackground(); } else { return super.getBackground(); } }
public void paintComponent (Graphics g) { //For property panel usage, allow the editor to paint if (editor != null && !hasFocus() && editor.isPaintable()) { Insets ins = getInsets(); Color c = g.getColor(); try { g.setColor(getBackground()); g.fillRect(0,0,getWidth(),getHeight()); } finally { g.setColor(c); } ins.left += PropUtils.getTextMargin(); editor.paintValue(g, new Rectangle(ins.left, ins.top, getWidth() - (ins.right + ins.left), getHeight() - (ins.top + ins.bottom))); } else { super.paintComponent(g); } }
/** Overridden to return the combo box's background color if selected * and focused - in GTK L&F combo boxes are always white (there's even * a "fixme" note in the code. */ public Color getBackground() { //This method can be called in the superclass constructor, thanks //to updateUI(). At that time, this==null, so an NPE would happen //if we tried tor reference the outer class if (ComboInplaceEditor.this == null) { return null; } if (!sel && (getText() != null && getSelectedItem() != null && getText().equals(getSelectedItem()))) { return ComboInplaceEditor.this.getBackground(); } else { return super.getBackground(); } }
@Override public void paintComponent(Graphics g) { //For property panel usage, allow the editor to paint if ((editor != null) && !hasFocus() && editor.isPaintable()) { Insets ins = getInsets(); Color c = g.getColor(); try { g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); } finally { g.setColor(c); } ins.left += PropUtils.getTextMargin(); editor.paintValue( g, new Rectangle( ins.left, ins.top, getWidth() - (ins.right + ins.left), getHeight() - (ins.top + ins.bottom) ) ); } else { g.setColor(Color.red); super.paintComponent(g); } }
private void prepareEditor() { Component c = getEditor().getEditorComponent(); if (c instanceof JTextComponent) { JTextComponent jtc = (JTextComponent) c; String s = jtc.getText(); if (s != null && s.length() > 0){ jtc.setSelectionStart(0); jtc.setSelectionEnd(s.length()); } if (tableUI) { jtc.setBackground(getBackground()); } else { jtc.setBackground(PropUtils.getTextFieldBackground()); } } if (getLayout() != null) { getLayout().layoutContainer(this); } repaint(); }
private void prepareEditor() { Component c = getEditor().getEditorComponent(); if (c instanceof JTextComponent) { JTextComponent jtc = (JTextComponent) c; String s = jtc.getText(); if (s != null && s.length() > 0){ jtc.setSelectionStart(0); jtc.setSelectionEnd(s.length()); } if (tableUI) { jtc.setBackground(getBackground()); } else { jtc.setBackground(PropUtils.getTextFieldBackground()); } } if (getLayout() != null) { getLayout().layoutContainer(this); } repaint(); }
private void prepareEditor() { Component c = getEditor().getEditorComponent(); if (c instanceof JTextComponent) { JTextComponent jtc = (JTextComponent) c; String s = jtc.getText(); if ((s != null) && (s.length() > 0)) { jtc.setSelectionStart(0); jtc.setSelectionEnd(s.length()); } if (tableUI) { jtc.setBackground(getBackground()); } else { jtc.setBackground(PropUtils.getTextFieldBackground()); } if( tableUI ) jtc.requestFocus(); } if (getLayout() != null) { getLayout().layoutContainer(this); } repaint(); }