diff options
| author | graydon <graydon@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-02-12 00:17:26 +0000 |
|---|---|---|
| committer | graydon <graydon@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-02-12 00:17:26 +0000 |
| commit | 866768aac52f3d2f415cf60c95b0a591c2130956 (patch) | |
| tree | fcb9c2df4781981800f59c865ef83b1963ac0eff /libjava/javax/swing/plaf/basic/BasicIconFactory.java | |
| parent | 8ef6479d36aca3e1a8188e0b42a095026b269a4f (diff) | |
| download | ppe42-gcc-866768aac52f3d2f415cf60c95b0a591c2130956.tar.gz ppe42-gcc-866768aac52f3d2f415cf60c95b0a591c2130956.zip | |
2004-02-09 Graydon Hoare <graydon@redhat.com>
* javax/swing/ToggleButtonModel.java: Remove dead class.
* javax/swing/plaf/basic/BasicDefaults.java: Remove dead class.
* javax/swing/plaf/basic/BasicButtonListener.java: New class.
* javax/swing/plaf/basic/BasicRootPaneUI.java: New class.
* Makefile.am: Update for new and removed files.
* Makefile.in: Regenerate.
* gnu/java/awt/peer/gtk/GdkGraphics2D.java: Initialize default hints.
* javax/swing/AbstractButton.java
(AbstractButton): Initialize fields correctly in ctor.
* javax/swing/JCheckbox.java
(JCheckBox): Override painting flags.
* javax/swing/DefaultButtonModel.java: Conform to sun.
* javax/swing/JComponent.java (paint): Fill with background color
if available.
(processComponentKeyEvent)
(processFocusEvent)
(processKeyEvent)
(processMouseMotionEvent): Remove event-consuming empty methods.
(getUIClassID): Return "ComponentUI" not "JComponent"
* javax/swing/JFrame.java: Remove some debugging chatter.
(JFrame): Subscribe to window events.
* javax/swing/JRadioButton.java
(JRadioButton): Override painting flags.
* javax/swing/JRootPane.java
(JRootPane): Set background from UIDefaults.
* javax/swing/JToggleButton.java
(ToggleButtonModel): New inner class.
(JToggleButton): Override layout alighment.
* javax/swing/SwingUtilities.java:
(getLocalBounds): Return width and height, not x and y.
(calculateInnerArea): Use local bounds, not bounds.
(layoutCompoundLabel): Provide overridden form.
(layoutCompoundLabel): Correct bugs.
* javax/swing/UIDefaults.java: Correct comment.
* javax/swing/plaf/basic/BasicButtonUI.java:
Move most logic into defaults, external listener.
(paintIcon): Implement icon painting.
(paint): Fix state painting to conform to changes in model.
* javax/swing/plaf/basic/BasicCheckBoxUI.java:
Remove most dead/wrong methods.
(getDefaultIcon): Return defaults.getIcon("CheckBox.icon").
* javax/swing/plaf/basic/BasicIconFactory.java:
(DummyIcon): New class.
(getMenuItemCheckIcon)
(getMenuItemArrowIcon)
(getMenuArrowIcon)
(getCheckBoxMenuItemIcon)
(getRadioButtonMenuItemIcon)
(createEmptyFrameIcon): Return DummyIcons, not null.
(getCheckBoxIcon): Implement an icon that looks like sun's.
(getRadioButtonIcon): Implement an icon that looks like sun's.
* javax/swing/plaf/basic/BasicLookAndFeel.java
(initComponentDefaults): Fix impossible values, add some missing.
* javax/swing/plaf/basic/BasicPanelUI.java (gap): Remove field.
* javax/swing/plaf/basic/BasicRadioButtonUI.java:
Remove most dead/wrong methods.
(icon): New field.
(getDefaultIcon): New method.
* javax/swing/plaf/basic/BasicToggleButtonUI.java:
Remove most dead/wrong methods.
* javax/swing/plaf/metal/MetalLookAndFeel.java
(getDefaults): Return super.getDefaults(), not BasicDefaults.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
(Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect):
Implement "clearing" as drawing, when on pixmap drawables.
* javax/swing/JButton.java (getUIClassID):
* javax/swing/JCheckBox.java (getUIClassID):
* javax/swing/JEditorPane.java (getUIClassID):
* javax/swing/JLabel.java (getUIClassID):
* javax/swing/JList.java (getUIClassID):
* javax/swing/JOptionPane.java (getUIClassID):
* javax/swing/JPanel.java (getUIClassID):
* javax/swing/JPasswordField.java (uiClassID):
* javax/swing/JRadioButton.java (getUIClassID):
* javax/swing/JRootPane.java (getUIClassID):
* javax/swing/JScrollPane.java (getUIClassID):
* javax/swing/JTabbedPane.java (getUIClassID):
* javax/swing/JToggleButton.java (getUIClassID):
* javax/swing/JTree.java (getUIClassID):
* javax/swing/JViewport.java (getUIClassID):
* javax/swing/text/JTextComponent.java (getUIClassID):
Return "fooUI" not "Jfoo"
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@77686 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/javax/swing/plaf/basic/BasicIconFactory.java')
| -rw-r--r-- | libjava/javax/swing/plaf/basic/BasicIconFactory.java | 140 |
1 files changed, 132 insertions, 8 deletions
diff --git a/libjava/javax/swing/plaf/basic/BasicIconFactory.java b/libjava/javax/swing/plaf/basic/BasicIconFactory.java index 3a8adf3bf18..39e86b6fbbc 100644 --- a/libjava/javax/swing/plaf/basic/BasicIconFactory.java +++ b/libjava/javax/swing/plaf/basic/BasicIconFactory.java @@ -39,7 +39,14 @@ exception statement from your version. */ package javax.swing.plaf.basic; import java.io.Serializable; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Polygon; +import javax.swing.AbstractButton; import javax.swing.Icon; +import javax.swing.UIDefaults; +import javax.swing.UIManager; /** * STUBBED */ @@ -47,39 +54,156 @@ public class BasicIconFactory implements Serializable { static final long serialVersionUID = 5605588811185324383L; + static private class DummyIcon + implements Icon + { + public int getIconHeight() { return 10; } + public int getIconWidth() { return 10; } + public void paintIcon(Component c, Graphics g, int x, int y) + { + Color save = g.getColor(); + g.setColor(c.getForeground()); + g.drawRect(x, y, 10, 10); + g.setColor(save); + } + } + + public BasicIconFactory() { } public static Icon getMenuItemCheckIcon() { - return null; + return new DummyIcon(); } public static Icon getMenuItemArrowIcon() { - return null; + return new DummyIcon(); } public static Icon getMenuArrowIcon() { - return null; + return new DummyIcon(); } + public static Icon getCheckBoxIcon() { - return null; + return new Icon() + { + public int getIconHeight() + { + return 10; + } + public int getIconWidth() + { + return 10; + } + public void paintIcon(Component c, Graphics g, int x, int y) + { + if (c instanceof AbstractButton) + { + UIDefaults defaults; + defaults = UIManager.getLookAndFeelDefaults(); + Color hi = defaults.getColor("CheckBox.highlight"); + Color low = defaults.getColor("CheckBox.darkShadow"); + Color sel = defaults.getColor("CheckBox.foreground"); + Color dim = defaults.getColor("CheckBox.shadow"); + Polygon check = new Polygon(new int[] {x+3, x+3, x+8}, + new int[] {y+5, y+9, y+3}, 3); + AbstractButton b = (AbstractButton) c; + Color saved = g.getColor(); + if (b.isEnabled()) + { + g.setColor(low); + g.drawRect(x, y, 10, 10); + g.setColor(hi); + g.drawRect(x+1, y+1, 10, 10); + if (b.isSelected()) + { + g.setColor(sel); + if (b.isSelected()) + { + g.drawLine(x+3, y+5, x+3, y+8); + g.drawLine(x+4, y+5, x+4, y+8); + g.drawLine(x+3, y+8, x+8, y+3); + g.drawLine(x+4, y+8, x+8, y+3); + } + } + } + else + { + g.setColor(hi); + g.drawRect(x, y, 10, 10); + if (b.isSelected()) + { + g.drawLine(x+3, y+5, x+3, y+9); + g.drawLine(x+3, y+9, x+8, y+3); + } + } + g.setColor(saved); + } + } + }; } + public static Icon getRadioButtonIcon() { - return null; + return new Icon() + { + public int getIconHeight() + { + return 12; + } + public int getIconWidth() + { + return 12; + } + public void paintIcon(Component c, Graphics g, int x, int y) + { + UIDefaults defaults; + defaults = UIManager.getLookAndFeelDefaults(); + Color hi = defaults.getColor("RadioButton.highlight"); + Color low = defaults.getColor("RadioButton.darkShadow"); + Color sel = defaults.getColor("RadioButton.foreground"); + Color dim = defaults.getColor("RadioButton.shadow"); + + if (c instanceof AbstractButton) + { + AbstractButton b = (AbstractButton) c; + Color saved = g.getColor(); + if (b.isEnabled()) + { + g.setColor(low); + g.drawOval(x, y, 12, 12); + g.setColor(hi); + g.drawOval(x+1, y+1, 12, 12); + if (b.isSelected()) + { + g.setColor(sel); + g.fillOval(x+4, y+4, 6, 6); + } + } + else + { + g.setColor(hi); + g.drawOval(x, y, 12, 12); + if (b.isSelected()) + g.fillOval(x+4, y+4, 6, 6); + } + g.setColor(saved); + } + } + }; } public static Icon getCheckBoxMenuItemIcon() { - return null; + return new DummyIcon(); } public static Icon getRadioButtonMenuItemIcon() { - return null; + return new DummyIcon(); } public static Icon createEmptyFrameIcon() { - return null; + return new DummyIcon(); } } // class BasicIconFactory |

