Commit 6a716777 by Michael Koch Committed by Michael Koch

MemoryImageSource.java, [...]: New versions from classpath.

2003-07-14  Michael Koch  <konqueror@gmx.de>

	* java/awt/image/MemoryImageSource.java,
	java/beans/PropertyEditorManager.java,
	javax/naming/CompoundName.java,
	javax/naming/spi/NamingManager.java,
	javax/swing/AbstractButton.java,
	javax/swing/ButtonModel.java,
	javax/swing/SwingUtilities.java,
	javax/swing/UIManager.java,
	javax/swing/colorchooser/DefaultColorSelectionModel.java,
	javax/swing/event/AncestorEvent.java,
	javax/swing/event/InternalFrameEvent.java,
	java/util/zip/ZipFile.java:
	New versions from classpath.

From-SVN: r69321
parent 6e985040
2003-07-14 Michael Koch <konqueror@gmx.de>
* java/awt/image/MemoryImageSource.java,
java/beans/PropertyEditorManager.java,
javax/naming/CompoundName.java,
javax/naming/spi/NamingManager.java,
javax/swing/AbstractButton.java,
javax/swing/ButtonModel.java,
javax/swing/SwingUtilities.java,
javax/swing/UIManager.java,
javax/swing/colorchooser/DefaultColorSelectionModel.java,
javax/swing/event/AncestorEvent.java,
javax/swing/event/InternalFrameEvent.java,
java/util/zip/ZipFile.java:
New versions from classpath.
2003-07-13 Michael Koch <konqueror@gmx.de> 2003-07-13 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/FileChannelImpl.java, * gnu/java/nio/FileChannelImpl.java,
......
...@@ -74,7 +74,7 @@ public class MemoryImageSource implements ImageProducer ...@@ -74,7 +74,7 @@ public class MemoryImageSource implements ImageProducer
this.props = props; this.props = props;
int max = (( scansize > width ) ? scansize : width ); int max = (( scansize > width ) ? scansize : width );
pixelb = new byte[ max * height ]; pixelb = new byte[ max * height ];
System.arraycopy( pix, 0, pixelb, 0, max ); System.arraycopy( pix, 0, pixelb, 0, max * height );
} }
/** /**
Constructs an ImageProducer from memory Constructs an ImageProducer from memory
...@@ -100,7 +100,7 @@ public class MemoryImageSource implements ImageProducer ...@@ -100,7 +100,7 @@ public class MemoryImageSource implements ImageProducer
this.props = props; this.props = props;
int max = (( scansize > width ) ? scansize : width ); int max = (( scansize > width ) ? scansize : width );
pixeli = new int[ max * height ]; pixeli = new int[ max * height ];
System.arraycopy( pix, 0, pixeli, 0, max ); System.arraycopy( pix, 0, pixeli, 0, max * height );
} }
/** /**
Constructs an ImageProducer from memory using the default RGB ColorModel Constructs an ImageProducer from memory using the default RGB ColorModel
...@@ -226,6 +226,7 @@ public class MemoryImageSource implements ImageProducer ...@@ -226,6 +226,7 @@ public class MemoryImageSource implements ImageProducer
if( props != null ) { if( props != null ) {
ic.setProperties( props ); ic.setProperties( props );
} }
ic.setDimensions(width, height);
if( pixeli != null ) { if( pixeli != null ) {
ic.setPixels( 0, 0, width, height, cm, pixeli, offset, scansize ); ic.setPixels( 0, 0, width, height, cm, pixeli, offset, scansize );
} else { } else {
......
...@@ -140,9 +140,13 @@ public class PropertyEditorManager ...@@ -140,9 +140,13 @@ public class PropertyEditorManager
return (PropertyEditor)found.newInstance(); return (PropertyEditor)found.newInstance();
} }
ClassLoader contextClassLoader
= Thread.currentThread().getContextClassLoader();
try try
{ {
found = Class.forName(editedClass.getName()+"Editor"); found = Class.forName(editedClass.getName()+"Editor", true,
contextClassLoader);
registerEditor(editedClass,found); registerEditor(editedClass,found);
return (PropertyEditor)found.newInstance(); return (PropertyEditor)found.newInstance();
} }
...@@ -150,14 +154,18 @@ public class PropertyEditorManager ...@@ -150,14 +154,18 @@ public class PropertyEditorManager
{ {
} }
String appendName = "." + ClassHelper.getTruncatedClassName(editedClass) + "Editor"; String appendName
= "."
+ ClassHelper.getTruncatedClassName(editedClass)
+ "Editor";
synchronized(editorSearchPath) synchronized(editorSearchPath)
{ {
for(int i=0;i<editorSearchPath.length;i++) for(int i=0;i<editorSearchPath.length;i++)
{ {
try try
{ {
found = Class.forName(editorSearchPath[i] + appendName); found = Class.forName(editorSearchPath[i] + appendName,
true, contextClassLoader);
registerEditor(editedClass,found); registerEditor(editedClass,found);
return (PropertyEditor)found.newInstance(); return (PropertyEditor)found.newInstance();
} }
......
...@@ -308,7 +308,7 @@ public class ZipFile implements ZipConstants ...@@ -308,7 +308,7 @@ public class ZipFile implements ZipConstants
*/ */
protected void finalize() throws IOException protected void finalize() throws IOException
{ {
if (!closed) close(); if (!closed && raf != null) close();
} }
/** /**
......
...@@ -142,13 +142,17 @@ public class CompoundName implements Name, Cloneable, Serializable ...@@ -142,13 +142,17 @@ public class CompoundName implements Name, Cloneable, Serializable
// Otherwise, fall through. // Otherwise, fall through.
} }
// Quotes are only special at the start of a component. // Quotes are only special at the start of a component.
else if (new_element.length () == 0 && special == beginQuote) else if (new_element.length () == 0
&& special == beginQuote
&& beginQuote != null)
{ {
quote = endQuote; quote = endQuote;
i += special.length (); i += special.length ();
continue; continue;
} }
else if (new_element.length () == 0 && special == beginQuote2) else if (new_element.length () == 0
&& special == beginQuote2
&& beginQuote2 != null)
{ {
quote = endQuote2; quote = endQuote2;
i += special.length (); i += special.length ();
......
...@@ -83,13 +83,17 @@ public class NamingManager ...@@ -83,13 +83,17 @@ public class NamingManager
try try
{ {
icf = (InitialContextFactory) Class.forName (java_naming_factory_initial).newInstance (); icf = (InitialContextFactory)Class.forName
(java_naming_factory_initial, true,
Thread.currentThread().getContextClassLoader())
.newInstance ();
} }
catch (Exception exception) catch (Exception exception)
{ {
NoInitialContextException e NoInitialContextException e
= new NoInitialContextException ("Can't load InitialContextFactory class: " = new NoInitialContextException
+ java_naming_factory_initial); ("Can't load InitialContextFactory class: "
+ java_naming_factory_initial);
e.setRootCause(exception); e.setRootCause(exception);
throw e; throw e;
} }
......
...@@ -71,740 +71,731 @@ import javax.swing.text.AttributeSet; ...@@ -71,740 +71,731 @@ import javax.swing.text.AttributeSet;
public abstract class AbstractButton extends JComponent public abstract class AbstractButton extends JComponent
implements ItemSelectable, SwingConstants implements ItemSelectable, SwingConstants
{ {
Icon default_icon, pressed_button, disabled_button, Icon default_icon, pressed_button, disabled_button,
selected_button, disabled_selected_button, current_icon; selected_button, disabled_selected_button, current_icon;
String text; String text;
int vert_align = CENTER; int vert_align = CENTER;
int hori_align = CENTER; int hori_align = CENTER;
int hori_text_pos = CENTER; int hori_text_pos = CENTER;
int vert_text_pos = CENTER; int vert_text_pos = CENTER;
boolean paint_border = true, paint_focus; boolean paint_border = true, paint_focus;
Action action_taken; Action action_taken;
ButtonModel model; ButtonModel model;
Insets margin; Insets margin;
public static final String FOCUS_PAINTED_CHANGED_PROPERTY = "focusPainted";
public static final String FOCUS_PAINTED_CHANGED_PROPERTY = "focusPainted";
/**
/** * AccessibleAbstractButton
* AccessibleAbstractButton */
*/ protected abstract class AccessibleAbstractButton
protected abstract class AccessibleAbstractButton extends AccessibleJComponent
extends AccessibleJComponent implements AccessibleAction, AccessibleValue, AccessibleText {
implements AccessibleAction, AccessibleValue, AccessibleText {
/**
//------------------------------------------------------------- * Constructor AccessibleAbstractButton
// Initialization --------------------------------------------- * @param component TODO
//------------------------------------------------------------- */
protected AccessibleAbstractButton(AbstractButton component) {
/** super(component);
* Constructor AccessibleAbstractButton // TODO
* @param component TODO } // AccessibleAbstractButton()
*/
protected AccessibleAbstractButton(AbstractButton component) { /**
super(component); * getAccessibleStateSet
// TODO * @returns AccessibleStateSet
} // AccessibleAbstractButton() */
public AccessibleStateSet getAccessibleStateSet() {
return null; // TODO
//------------------------------------------------------------- } // getAccessibleStateSet()
// Methods ----------------------------------------------------
//------------------------------------------------------------- /**
* getAccessibleName
/** * @returns String
* getAccessibleStateSet */
* @returns AccessibleStateSet public String getAccessibleName() {
*/ return null; // TODO
public AccessibleStateSet getAccessibleStateSet() { } // getAccessibleName()
return null; // TODO
} // getAccessibleStateSet() /**
* getAccessibleIcon
/** * @returns AccessibleIcon[]
* getAccessibleName */
* @returns String public AccessibleIcon[] getAccessibleIcon() {
*/ return null; // TODO
public String getAccessibleName() { } // getAccessibleIcon()
return null; // TODO
} // getAccessibleName() /**
* getAccessibleRelationSet
/** * @returns AccessibleRelationSet
* getAccessibleIcon */
* @returns AccessibleIcon[] public AccessibleRelationSet getAccessibleRelationSet() {
*/ return null; // TODO
public AccessibleIcon[] getAccessibleIcon() { } // getAccessibleRelationSet()
return null; // TODO
} // getAccessibleIcon() /**
* getAccessibleAction
/** * @returns AccessibleAction
* getAccessibleRelationSet */
* @returns AccessibleRelationSet public AccessibleAction getAccessibleAction() {
*/ return null; // TODO
public AccessibleRelationSet getAccessibleRelationSet() { } // getAccessibleAction()
return null; // TODO
} // getAccessibleRelationSet() /**
* getAccessibleValue
/** * @returns AccessibleValue
* getAccessibleAction */
* @returns AccessibleAction public AccessibleValue getAccessibleValue() {
*/ return null; // TODO
public AccessibleAction getAccessibleAction() { } // getAccessibleValue()
return null; // TODO
} // getAccessibleAction() /**
* getAccessibleActionCount
/** * @returns int
* getAccessibleValue */
* @returns AccessibleValue public int getAccessibleActionCount() {
*/ return 0; // TODO
public AccessibleValue getAccessibleValue() { } // getAccessibleActionCount()
return null; // TODO
} // getAccessibleValue() /**
* getAccessibleActionDescription
/** * @param value0 TODO
* getAccessibleActionCount * @returns String
* @returns int */
*/ public String getAccessibleActionDescription(int value0) {
public int getAccessibleActionCount() { return null; // TODO
return 0; // TODO } // getAccessibleActionDescription()
} // getAccessibleActionCount()
/**
/** * doAccessibleAction
* getAccessibleActionDescription * @param value0 TODO
* @param value0 TODO * @returns boolean
* @returns String */
*/ public boolean doAccessibleAction(int value0) {
public String getAccessibleActionDescription(int value0) { return false; // TODO
return null; // TODO } // doAccessibleAction()
} // getAccessibleActionDescription()
/**
/** * getCurrentAccessibleValue
* doAccessibleAction * @returns Number
* @param value0 TODO */
* @returns boolean public Number getCurrentAccessibleValue() {
*/ return null; // TODO
public boolean doAccessibleAction(int value0) { } // getCurrentAccessibleValue()
return false; // TODO
} // doAccessibleAction() /**
* setCurrentAccessibleValue
/** * @param value0 TODO
* getCurrentAccessibleValue * @returns boolean
* @returns Number */
*/ public boolean setCurrentAccessibleValue(Number value0) {
public Number getCurrentAccessibleValue() { return false; // TODO
return null; // TODO } // setCurrentAccessibleValue()
} // getCurrentAccessibleValue()
/**
/** * getMinimumAccessibleValue
* setCurrentAccessibleValue * @returns Number
* @param value0 TODO */
* @returns boolean public Number getMinimumAccessibleValue() {
*/ return null; // TODO
public boolean setCurrentAccessibleValue(Number value0) { } // getMinimumAccessibleValue()
return false; // TODO
} // setCurrentAccessibleValue() /**
* getMaximumAccessibleValue
/** * @returns Number
* getMinimumAccessibleValue */
* @returns Number public Number getMaximumAccessibleValue() {
*/ return null; // TODO
public Number getMinimumAccessibleValue() { } // getMaximumAccessibleValue()
return null; // TODO
} // getMinimumAccessibleValue() /**
* getAccessibleText
/** * @returns AccessibleText
* getMaximumAccessibleValue */
* @returns Number public AccessibleText getAccessibleText() {
*/ return null; // TODO
public Number getMaximumAccessibleValue() { } // getAccessibleText()
return null; // TODO
} // getMaximumAccessibleValue() /**
* getIndexAtPoint
/** * @param value0 TODO
* getAccessibleText * @returns int
* @returns AccessibleText */
*/ public int getIndexAtPoint(Point value0) {
public AccessibleText getAccessibleText() { return 0; // TODO
return null; // TODO } // getIndexAtPoint()
} // getAccessibleText()
/**
/** * getCharacterBounds
* getIndexAtPoint * @param value0 TODO
* @param value0 TODO * @returns Rectangle
* @returns int */
*/ public Rectangle getCharacterBounds(int value0) {
public int getIndexAtPoint(Point value0) { return null; // TODO
return 0; // TODO } // getCharacterBounds()
} // getIndexAtPoint()
/**
/** * getCharCount
* getCharacterBounds * @returns int
* @param value0 TODO */
* @returns Rectangle public int getCharCount() {
*/ return 0; // TODO
public Rectangle getCharacterBounds(int value0) { } // getCharCount()
return null; // TODO
} // getCharacterBounds() /**
* getCaretPosition
/** * @returns int
* getCharCount */
* @returns int public int getCaretPosition() {
*/ return 0; // TODO
public int getCharCount() { } // getCaretPosition()
return 0; // TODO
} // getCharCount() /**
* getAtIndex
/** * @param value0 TODO
* getCaretPosition * @param value1 TODO
* @returns int * @returns String
*/ */
public int getCaretPosition() { public String getAtIndex(int value0, int value1) {
return 0; // TODO return null; // TODO
} // getCaretPosition() } // getAtIndex()
/** /**
* getAtIndex * getAfterIndex
* @param value0 TODO * @param value0 TODO
* @param value1 TODO * @param value1 TODO
* @returns String * @returns String
*/ */
public String getAtIndex(int value0, int value1) { public String getAfterIndex(int value0, int value1) {
return null; // TODO return null; // TODO
} // getAtIndex() } // getAfterIndex()
/** /**
* getAfterIndex * getBeforeIndex
* @param value0 TODO * @param value0 TODO
* @param value1 TODO * @param value1 TODO
* @returns String * @returns String
*/ */
public String getAfterIndex(int value0, int value1) { public String getBeforeIndex(int value0, int value1) {
return null; // TODO return null; // TODO
} // getAfterIndex() } // getBeforeIndex()
/** /**
* getBeforeIndex * getCharacterAttribute
* @param value0 TODO * @param value0 TODO
* @param value1 TODO * @returns AttributeSet
* @returns String */
*/ public AttributeSet getCharacterAttribute(int value0) {
public String getBeforeIndex(int value0, int value1) { return null; // TODO
return null; // TODO } // getCharacterAttribute()
} // getBeforeIndex()
/**
/** * getSelectionStart
* getCharacterAttribute * @returns int
* @param value0 TODO */
* @returns AttributeSet public int getSelectionStart() {
*/ return 0; // TODO
public AttributeSet getCharacterAttribute(int value0) { } // getSelectionStart()
return null; // TODO
} // getCharacterAttribute() /**
* getSelectionEnd
/** * @returns int
* getSelectionStart */
* @returns int public int getSelectionEnd() {
*/ return 0; // TODO
public int getSelectionStart() { } // getSelectionEnd()
return 0; // TODO
} // getSelectionStart() /**
* getSelectedText
/** * @returns String
* getSelectionEnd */
* @returns int public String getSelectedText() {
*/ return null; // TODO
public int getSelectionEnd() { } // getSelectedText()
return 0; // TODO
} // getSelectionEnd() /**
* getTextRectangle
/** * @returns Rectangle
* getSelectedText */
* @returns String private Rectangle getTextRectangle() {
*/ return null; // TODO
public String getSelectedText() { } // getTextRectangle()
return null; // TODO
} // getSelectedText()
} // AccessibleAbstractButton
/**
* getTextRectangle
* @returns Rectangle static private class JFocusListener implements FocusListener
*/ {
private Rectangle getTextRectangle() { AbstractButton c;
return null; // TODO
} // getTextRectangle() JFocusListener(AbstractButton c)
{
this.c = c;
} // AccessibleAbstractButton }
public void focusLost(FocusEvent event)
static private class JFocusListener implements FocusListener {
{ c.getModel().setArmed(false);
AbstractButton c;
System.out.println("LOST FOCUS");
JFocusListener(AbstractButton c) if (c.isFocusPainted())
{ {
this.c = c; c.repaint();
} }
}
public void focusLost(FocusEvent event) public void focusGained(FocusEvent event)
{ {
c.getModel().setArmed(false); System.out.println("GAIN FOCUS");
}
System.out.println("LOST FOCUS"); }
if (c.isFocusPainted())
{ AbstractButton()
c.repaint(); {
} this("",null);
} }
public void focusGained(FocusEvent event)
{ AbstractButton(String text,
System.out.println("GAIN FOCUS"); Icon icon)
} {
} this.text = text;
setIcon(icon);
/********************************************** setAlignmentX(LEFT_ALIGNMENT);
* setAlignmentY(CENTER_ALIGNMENT);
*
* Constructors addFocusListener( new JFocusListener(this) );
*
* setModel(new DefaultButtonModel(this));
****************/
updateUI(); // get a proper ui
AbstractButton() }
{
this("",null); public ButtonModel getModel()
} { return model; }
AbstractButton(String text, public void setModel(ButtonModel newModel)
Icon icon) { model = newModel; }
{
this.text = text; public String getActionCommand()
setIcon(icon); { return getModel().getActionCommand(); }
setAlignmentX(LEFT_ALIGNMENT); public void setActionCommand(String aCommand)
setAlignmentY(CENTER_ALIGNMENT); { getModel().setActionCommand(aCommand); }
addFocusListener( new JFocusListener(this) ); public void addActionListener(ActionListener l)
{ getModel().addActionListener(l); }
setModel(new DefaultButtonModel(this));
public void removeActionListener(ActionListener l)
updateUI(); // get a proper ui { getModel().removeActionListener(l); }
}
public void addChangeListener(ChangeListener l)
{ getModel().addChangeListener(l); }
/**********************************************
* public void removeChangeListener(ChangeListener l)
* { getModel().removeChangeListener(l); }
* Actions etc
* public void addItemListener(ItemListener l)
* { getModel().addItemListener(l); }
****************/
public void removeItemListener(ItemListener l)
public ButtonModel getModel() { getModel().removeItemListener(l); }
{ return model; }
public void setModel(ButtonModel newModel) public int getHorizontalAlignment()
{ model = newModel; } { return hori_align; }
public String getActionCommand() public int getHorizontalTextPosition()
{ return getModel().getActionCommand(); } { return hori_text_pos; }
public void setActionCommand(String aCommand)
{ getModel().setActionCommand(aCommand); } public int getVerticalAlignment()
{ return vert_align; }
public void addActionListener(ActionListener l)
{ getModel().addActionListener(l); } public int getVerticalTextPosition()
public void removeActionListener(ActionListener l) { return vert_text_pos; }
{ getModel().removeActionListener(l); }
protected void fireItemStateChanged(ItemEvent event)
public void addChangeListener(ChangeListener l) {
{ getModel().addChangeListener(l); } }
public void removeChangeListener(ChangeListener l)
{ getModel().removeChangeListener(l); } protected void fireStateChanged(ChangeEvent event)
{
public void addItemListener(ItemListener l) }
{ getModel().addItemListener(l); }
public void removeItemListener(ItemListener l) protected void fireActionPerformed(ActionEvent event)
{ getModel().removeItemListener(l); } {
}
public int getHorizontalAlignment()
{ return hori_align; } public void setVerticalAlignment(int alignment)
public int getHorizontalTextPosition() { vert_align = alignment; }
{ return hori_text_pos; }
public int getVerticalAlignment() public void setHorizontalAlignment(int alignment)
{ return vert_align; } { hori_align = alignment; }
public int getVerticalTextPosition()
{ return vert_text_pos; } public void setVerticalTextPosition(int textPosition)
{ vert_text_pos = textPosition; }
protected void fireItemStateChanged(ItemEvent event) public void setHorizontalTextPosition(int textPosition)
{ getModel().fireItemStateChanged(event); } { hori_text_pos = textPosition; }
protected void fireStateChanged(ChangeEvent event)
{ getModel().fireStateChanged(event); } public int getMnemonic()
protected void fireActionPerformed(ActionEvent event) { return getModel().getMnemonic(); }
{ getModel().fireActionPerformed(event); }
public void setMnemonic(char mne)
public void setVerticalAlignment(int alignment) { getModel().setMnemonic(mne); }
{ vert_align = alignment; }
public void setHorizontalAlignment(int alignment) public void setMnemonic(int mne)
{ hori_align = alignment; } { getModel().setMnemonic(mne); }
public void setVerticalTextPosition(int textPosition)
{ vert_text_pos = textPosition; } public void setRolloverEnabled(boolean b)
public void setHorizontalTextPosition(int textPosition) { getModel().setRollover(b); }
{ hori_text_pos = textPosition; }
public boolean isRolloverEnabled()
public int getMnemonic() { return getModel().isRollover(); }
{ return getModel().getMnemonic(); }
public void setMnemonic(char mne) public boolean isBorderPainted()
{ getModel().setMnemonic(mne); } { return paint_border; }
public void setMnemonic(int mne)
{ getModel().setMnemonic(mne); } public void setBorderPainted(boolean b)
{
public void setRolloverEnabled(boolean b) if (b != paint_border)
{ getModel().setRollover(b); } {
public boolean isRolloverEnabled() paint_border = b;
{ return getModel().isRollover(); } revalidate();
repaint();
}
public boolean isBorderPainted() }
{ return paint_border; }
public void setBorderPainted(boolean b) public Action getAction()
{ { return action_taken; }
if (b != paint_border)
{ public void setAction(Action a)
paint_border = b; {
revalidate(); action_taken = a;
repaint(); revalidate();
} repaint();
} }
public Action getAction() public void setSelected(boolean b)
{ return action_taken; } { getModel().setSelected(b); }
public void setAction(Action a)
{ public boolean isSelected()
action_taken = a; { return getModel().isSelected(); }
revalidate();
repaint(); public Icon getIcon()
} { return default_icon; }
public void setSelected(boolean b) public void setIcon(Icon defaultIcon)
{ getModel().setSelected(b); } {
public boolean isSelected() if (default_icon == defaultIcon)
{ return getModel().isSelected(); } return;
default_icon = defaultIcon;
public Icon getIcon() if (default_icon != null)
{ return default_icon; } {
public void setIcon(Icon defaultIcon) // XXX FIXME - icons do not know their parent
{ // default_icon.setParent(this);
if (default_icon == defaultIcon) }
return; revalidate();
repaint();
default_icon = defaultIcon; }
if (default_icon != null)
{ public String getText()
// XXX FIXME - icons do not know their parent { return text; }
// default_icon.setParent(this);
} public void setLabel(String label)
revalidate(); { setText(label); }
repaint();
} public String getLabel()
{ return getText(); }
public String getText()
{ return text; } public void setText(String text)
public void setLabel(String label) {
{ setText(label); } this.text = text;
public String getLabel() revalidate();
{ return getText(); } repaint();
public void setText(String text) }
{
this.text = text; public Insets getMargin()
revalidate(); { return margin; }
repaint();
} public void setMargin(Insets m)
{
margin = m;
public Insets getMargin() revalidate();
{ return margin; } repaint();
public void setMargin(Insets m) }
{
margin = m; public void setEnabled(boolean b)
revalidate(); {
repaint(); super.setEnabled(b);
} getModel().setEnabled(b);
repaint();
public void setEnabled(boolean b) }
{
super.setEnabled(b); public Icon getPressedIcon()
getModel().setEnabled(b); { return pressed_button; }
repaint();
} public void setPressedIcon(Icon pressedIcon)
{
public Icon getPressedIcon() pressed_button = pressedIcon;
{ return pressed_button; } revalidate();
public void setPressedIcon(Icon pressedIcon) repaint();
{ }
pressed_button = pressedIcon;
revalidate(); public Icon getDisabledIcon()
repaint(); { return disabled_button; }
}
public void setDisabledIcon(Icon disabledIcon)
{
public Icon getDisabledIcon() disabled_button = disabledIcon;
{ return disabled_button; } revalidate();
public void setDisabledIcon(Icon disabledIcon) repaint();
{ }
disabled_button = disabledIcon;
revalidate(); public boolean isFocusPainted()
repaint(); { return paint_focus; }
}
public void setFocusPainted(boolean b)
public boolean isFocusPainted() {
{ return paint_focus; } boolean old = paint_focus;
public void setFocusPainted(boolean b) paint_focus = b;
{
boolean old = paint_focus; firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY,
paint_focus = b; old,
b);
firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY, if (hasFocus())
old, {
b); revalidate();
if (hasFocus()) repaint();
{ }
revalidate(); }
repaint();
} public boolean isFocusTraversable()
} {
//Identifies whether or not this component can receive the focus.
public boolean isFocusTraversable() return true;
{ }
//Identifies whether or not this component can receive the focus.
return true;
} protected int checkHorizontalKey(int key, String exception)
{
// Verify that key is a legal value for the horizontalAlignment properties.
protected int checkHorizontalKey(int key, String exception) return 0;
{ }
// Verify that key is a legal value for the horizontalAlignment properties.
return 0; protected int checkVerticalKey(int key, String exception)
} {
protected int checkVerticalKey(int key, String exception) // Ensures that the key is a valid.
{ return 0;
// Ensures that the key is a valid. }
return 0;
} protected void configurePropertiesFromAction(Action a)
protected void configurePropertiesFromAction(Action a) {
{ //Factory method which sets the ActionEvent source's properties according to values from the Action instance.
//Factory method which sets the ActionEvent source's properties according to values from the Action instance. }
}
protected ActionListener createActionListener()
protected ActionListener createActionListener() {
{ return new ActionListener()
return new ActionListener() {
{ public void actionPerformed(ActionEvent e) { }
public void actionPerformed(ActionEvent e) { } };
}; }
}
protected PropertyChangeListener createActionPropertyChangeListener(Action a)
protected PropertyChangeListener createActionPropertyChangeListener(Action a) {
{ //Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance.
//Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance. return null;
return null; }
}
protected ChangeListener createChangeListener() protected ChangeListener createChangeListener()
{ {
// Subclasses that want to handle ChangeEvents differently can override this to return another ChangeListener implementation. // Subclasses that want to handle ChangeEvents differently can override this to return another ChangeListener implementation.
return new ChangeListener() return new ChangeListener()
{ {
public void stateChanged(ChangeEvent e) { } public void stateChanged(ChangeEvent e) { }
}; };
} }
protected ItemListener createItemListener() protected ItemListener createItemListener()
{ {
return new ItemListener() return new ItemListener()
{ {
public void itemStateChanged(ItemEvent e) { } public void itemStateChanged(ItemEvent e) { }
}; };
} }
public void doClick()
public void doClick() {
{ doClick(100);
doClick(100); }
}
public void doClick(int pressTime) public void doClick(int pressTime)
{ {
//Toolkit.tlkBeep (); //Toolkit.tlkBeep ();
//Programmatically perform a "click". //Programmatically perform a "click".
} }
public Icon getDisabledSelectedIcon()
public Icon getDisabledSelectedIcon() {
{ //Returns the icon used by the button when it's disabled and selected.
//Returns the icon used by the button when it's disabled and selected. return disabled_selected_button;
return disabled_selected_button; }
}
public Icon getRolloverIcon()
{
public Icon getRolloverIcon() // Returns the rollover icon for the button.
{ return null;
// Returns the rollover icon for the button. }
return null;
} Icon getRolloverSelectedIcon()
{
Icon getRolloverSelectedIcon() // Returns the rollover selection icon for the button.
{ return null;
// Returns the rollover selection icon for the button. }
return null;
} Icon getSelectedIcon()
Icon getSelectedIcon() {
{ // Returns the selected icon for the button.
// Returns the selected icon for the button. return selected_button;
return selected_button; }
}
public Object[] getSelectedObjects()
{
public Object[] getSelectedObjects() //Returns an array (length 1) containing the label or null if the button is not selected.
{ return null;
//Returns an array (length 1) containing the label or null if the button is not selected. }
return null;
} public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h)
{
//This is overridden to return false if the current Icon's Image is not equal to the passed in Image img.
public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h) return current_icon == img;
{ }
//This is overridden to return false if the current Icon's Image is not equal to the passed in Image img.
return current_icon == img; public boolean isContentAreaFilled()
} {
// Checks whether the "content area" of the button should be filled.
public boolean isContentAreaFilled() return false;
{ }
// Checks whether the "content area" of the button should be filled.
return false; protected void paintBorder(Graphics g)
} {
// Paint the button's border if BorderPainted property is true.
if (isBorderPainted())
super.paintBorder(g);
protected void paintBorder(Graphics g) }
{
// Paint the button's border if BorderPainted property is true. protected String paramString()
if (isBorderPainted()) {
super.paintBorder(g); // Returns a string representation of this AbstractButton.
} return "AbstractButton";
protected String paramString() }
{
// Returns a string representation of this AbstractButton. public void setContentAreaFilled(boolean b)
return "AbstractButton"; {
} //Sets whether the button should paint the content area or leave it transparent.
}
public void setContentAreaFilled(boolean b) public void setDisabledSelectedIcon(Icon disabledSelectedIcon)
{ {
//Sets whether the button should paint the content area or leave it transparent. // Sets the disabled selection icon for the button.
} }
public void setRolloverIcon(Icon rolloverIcon)
public void setDisabledSelectedIcon(Icon disabledSelectedIcon) {
{ // Sets the rollover icon for the button.
// Sets the disabled selection icon for the button. }
} public void setRolloverSelectedIcon(Icon rolloverSelectedIcon)
{
public void setRolloverIcon(Icon rolloverIcon) // Sets the rollover selected icon for the button.
{ }
// Sets the rollover icon for the button.
} public void setSelectedIcon(Icon selectedIcon)
public void setRolloverSelectedIcon(Icon rolloverSelectedIcon) {
{ // Sets the selected icon for the button.
// Sets the rollover selected icon for the button. }
}
public void setUI(ButtonUI ui)
{ // Sets the L&F object that renders this component.
public void setSelectedIcon(Icon selectedIcon) super.setUI(ui);
{ }
// Sets the selected icon for the button.
} public ButtonUI getUI()
{
//Returns the L&F object that renders this component.
public void setUI(ButtonUI ui) return (ButtonUI) ui;
{ // Sets the L&F object that renders this component. }
super.setUI(ui);
} public void updateUI()
{
public ButtonUI getUI() /*
{ // Notification from the UIFactory that the L&F has changed.
//Returns the L&F object that renders this component. if (getUI() == null)
return (ButtonUI) ui; {
} setUI(getUI());
}
public void updateUI() */
{ }
/*
// Notification from the UIFactory that the L&F has changed. protected void processActionEvent(ActionEvent e)
if (getUI() == null) {
{ System.out.println("PROCESS-ACTION-EVENT: " + e);
setUI(getUI()); }
}
*/ protected void processMouseEvent(MouseEvent e)
} {
// System.out.println("PROCESS-MOUSE-EVENT: " + e + ", PRESSED-IN-MODEL="+getModel().isPressed());
protected void processActionEvent(ActionEvent e)
{ switch (e.getID())
System.out.println("PROCESS-ACTION-EVENT: " + e); {
} case MouseEvent.MOUSE_MOVED:
{
break;
protected void processMouseEvent(MouseEvent e) }
{ case MouseEvent.MOUSE_PRESSED:
// System.out.println("PROCESS-MOUSE-EVENT: " + e + ", PRESSED-IN-MODEL="+getModel().isPressed()); {
if (! isEnabled())
switch (e.getID()) {
{ System.out.println("button not enabled, ignoring press");
case MouseEvent.MOUSE_MOVED: }
{ else
break; {
} System.out.println("telling model:press: " + getModel());
case MouseEvent.MOUSE_PRESSED: getModel().setPressed(true);
{ repaint();
if (! isEnabled()) }
{ break;
System.out.println("button not enabled, ignoring press"); }
}
else case MouseEvent.MOUSE_RELEASED:
{ {
System.out.println("telling model:press: " + getModel()); if (! isEnabled())
getModel().setPressed(true); {
repaint(); System.out.println("button not enabled, ignoring release");
} }
break; else
} {
int flags = 0;
case MouseEvent.MOUSE_RELEASED:
{ System.out.println(" XXX--> " + getActionCommand());
if (! isEnabled())
{ fireActionPerformed(new ActionEvent(this,
System.out.println("button not enabled, ignoring release"); ActionEvent.ACTION_PERFORMED,
} getActionCommand(),
else flags));
{
int flags = 0; //System.out.println("telling model:release");
getModel().setPressed(false);
System.out.println(" XXX--> " + getActionCommand()); repaint();
}
fireActionPerformed(new ActionEvent(this, break;
ActionEvent.ACTION_PERFORMED, }
getActionCommand(), case MouseEvent.MOUSE_CLICKED:
flags)); {
break;
//System.out.println("telling model:release"); }
getModel().setPressed(false); }
repaint(); }
}
break;
}
case MouseEvent.MOUSE_CLICKED:
{
break;
}
}
}
} }
...@@ -76,12 +76,4 @@ public interface ButtonModel extends ItemSelectable ...@@ -76,12 +76,4 @@ public interface ButtonModel extends ItemSelectable
void setSelected(boolean b); void setSelected(boolean b);
boolean isSelected(); boolean isSelected();
// there are not in the spec !!
void fireItemStateChanged(ItemEvent event);
void fireStateChanged(ChangeEvent event);
void fireActionPerformed(ActionEvent event);
} }
...@@ -58,70 +58,71 @@ import javax.accessibility.AccessibleStateSet; ...@@ -58,70 +58,71 @@ import javax.accessibility.AccessibleStateSet;
public class SwingUtilities implements SwingConstants public class SwingUtilities implements SwingConstants
{ {
public static FontMetrics getFontMetrics (Font font) public static FontMetrics getFontMetrics (Font font)
{ {
return Toolkit.getDefaultToolkit().getFontMetrics(font); return Toolkit.getDefaultToolkit ().getFontMetrics (font);
} }
public static JRootPane getRootPane (Component a) public static JRootPane getRootPane (Component a)
{ {
if (a instanceof JRootPane) if (a instanceof JRootPane)
return (JRootPane) a; return (JRootPane) a;
a = a.getParent(); a = a.getParent();
if (a != null)
{
return getRootPane(a);
}
return null; if (a != null)
} {
return getRootPane(a);
}
return null;
}
public static void updateComponentTreeUI(JFrame comp) public static void updateComponentTreeUI(JFrame comp)
{ {
} }
public static String layoutCompoundLabel(JComponent c, public static String layoutCompoundLabel(JComponent c,
FontMetrics fm, FontMetrics fm,
String text, String text,
Icon i, Icon i,
int vert_a, int vert_a,
int hor_i, int hor_i,
int vert_text_pos, int vert_text_pos,
int hor_text_pos, int hor_text_pos,
Rectangle vr, Rectangle vr,
Rectangle ir, Rectangle ir,
Rectangle tr, Rectangle tr,
int gap) int gap)
{ {
// view rect 'vr' already ok, // view rect 'vr' already ok,
// we need to compute ir (icon rect) and tr (text-rect) // we need to compute ir (icon rect) and tr (text-rect)
int next_x = 0;//vr.x; int next_x = 0;//vr.x;
int next_y = 0;//vr.y; int next_y = 0;//vr.y;
ir.height = ir.width = ir.y = ir.x = 0; ir.height = ir.width = ir.y = ir.x = 0;
if (i != null) if (i != null)
{ {
ir.x = vr.x; ir.x = vr.x;
ir.y = vr.y; ir.y = vr.y;
ir.width = i.getIconWidth(); ir.width = i.getIconWidth();
ir.height = i.getIconWidth(); ir.height = i.getIconWidth();
next_x += gap + i.getIconWidth(); next_x += gap + i.getIconWidth();
next_y += gap + i.getIconHeight(); next_y += gap + i.getIconHeight();
} }
tr.x = next_x; tr.x = next_x;
tr.y = vr.y + (vr.height/2); tr.y = vr.y + (vr.height/2);
tr.width = fm.stringWidth(text);
tr.height = fm.getHeight() + fm.getAscent()/2;
tr.width = fm.stringWidth(text); return text;
tr.height = fm.getHeight() + fm.getAscent()/2; }
return text;
}
} }
......
...@@ -50,131 +50,137 @@ import javax.swing.plaf.metal.MetalLookAndFeel; ...@@ -50,131 +50,137 @@ import javax.swing.plaf.metal.MetalLookAndFeel;
public class UIManager implements Serializable public class UIManager implements Serializable
{ {
static final long serialVersionUID = -5547433830339189365L; public static class LookAndFeelInfo
{
static class LookAndFeelInfo String name, clazz;
{
String name, clazz;
LookAndFeelInfo(String name, LookAndFeelInfo(String name,
String clazz) String clazz)
{ {
this.name = name; this.name = name;
this.clazz = clazz; this.clazz = clazz;
}
String getName() { return name; }
String getClassName() { return clazz; }
} }
String getName() { return name; }
static LookAndFeelInfo [] installed = { String getClassName() { return clazz; }
new LookAndFeelInfo("Metal", }
"javax.swing.plaf.metal.MetalLookAndFeel")
};
private static final long serialVersionUID = -5547433830339189365L;
static LookAndFeelInfo [] installed = {
new LookAndFeelInfo ("Metal", "javax.swing.plaf.metal.MetalLookAndFeel")
};
static LookAndFeel[] aux_installed;
static LookAndFeel look_and_feel = new MetalLookAndFeel();
static LookAndFeel[] aux_installed; public UIManager()
{
static LookAndFeel look_and_feel = new MetalLookAndFeel(); // Do nothing here.
}
UIManager() public static void addPropertyChangeListener (PropertyChangeListener listener)
{ {
} // FIXME
}
public static void addPropertyChangeListener(PropertyChangeListener listener) public static void removePropertyChangeListener (PropertyChangeListener listener)
{ // Remove a PropertyChangeListener from the listener list.
// Add a PropertyChangeListener to the listener list. {
} // FIXME
}
public static void addAuxiliaryLookAndFeel(LookAndFeel l) /**
{ * @since 1.4
// Add a LookAndFeel to the list of auxiliary look and feels. */
if (aux_installed == null) public static PropertyChangeListener[] getPropertyChangeListeners ()
{ {
aux_installed = new LookAndFeel[1]; // FIXME
aux_installed[0] = l; throw new Error ("Not implemented");
return; }
}
public static void addAuxiliaryLookAndFeel (LookAndFeel l)
{
// Add a LookAndFeel to the list of auxiliary look and feels.
if (aux_installed == null)
{
aux_installed = new LookAndFeel[1];
aux_installed[0] = l;
return;
}
LookAndFeel[] T = new LookAndFeel[ aux_installed.length+1 ]; LookAndFeel[] T = new LookAndFeel[ aux_installed.length+1 ];
System.arraycopy(aux_installed, 0, System.arraycopy(aux_installed, 0, T, 0, aux_installed.length);
T, 0, aux_installed = T;
aux_installed.length); aux_installed[aux_installed.length-1] = l;
aux_installed = T; }
aux_installed[aux_installed.length-1] = l;
}
public static boolean removeAuxiliaryLookAndFeel(LookAndFeel laf) public static boolean removeAuxiliaryLookAndFeel(LookAndFeel laf)
{ {
if (aux_installed == null) if (aux_installed == null)
return false; return false;
for (int i=0;i<aux_installed.length;i++) for (int i=0;i<aux_installed.length;i++)
{ {
if (aux_installed[i] == laf) if (aux_installed[i] == laf)
{ {
aux_installed[ i ] = aux_installed[aux_installed.length-1]; aux_installed[ i ] = aux_installed[aux_installed.length-1];
LookAndFeel[] T = new LookAndFeel[ aux_installed.length-1 ];
LookAndFeel[] T = new LookAndFeel[ aux_installed.length-1 ]; System.arraycopy (aux_installed, 0, T, 0, aux_installed.length-1);
System.arraycopy(aux_installed, 0, aux_installed = T;
T, 0, return true;
aux_installed.length-1); }
aux_installed = T; }
return true; return false;
} }
}
return false;
}
public static LookAndFeel[] getAuxiliaryLookAndFeels()
{ return aux_installed; }
public static LookAndFeel[] getAuxiliaryLookAndFeels()
{ return aux_installed; }
public static Object get(Object key) public static Object get(Object key)
{ return getLookAndFeel().getDefaults().get(key); } { return getLookAndFeel().getDefaults().get(key); }
/** /**
* Returns a border from the defaults table. * Returns a border from the defaults table.
*/ */
public static Border getBorder(Object key) public static Border getBorder(Object key)
{ {
return (Border) getLookAndFeel().getDefaults().get(key); return (Border) getLookAndFeel().getDefaults().get(key);
} }
/** /**
* Returns a drawing color from the defaults table. * Returns a drawing color from the defaults table.
*/ */
public static Color getColor(Object key) public static Color getColor(Object key)
{ {
return (Color) getLookAndFeel().getDefaults().get(key); return (Color) getLookAndFeel().getDefaults().get(key);
} }
/**
* this string can be passed to Class.forName()
*/
public static String getCrossPlatformLookAndFeelClassName()
{
return "javax.swing.plaf.metal.MetalLookAndFeel";
}
/** /**
* Returns the default values for this look and feel. * this string can be passed to Class.forName()
*/ */
static UIDefaults getDefaults() public static String getCrossPlatformLookAndFeelClassName()
{ {
return getLookAndFeel().getDefaults(); return "javax.swing.plaf.metal.MetalLookAndFeel";
} }
/** /**
* Returns a dimension from the defaults table. * Returns the default values for this look and feel.
*/ */
static Dimension getDimension(Object key) static UIDefaults getDefaults()
{ {
System.out.println("UIManager.getDim"); return getLookAndFeel().getDefaults();
return new Dimension(200,100); }
}
/**
* Returns a dimension from the defaults table.
*/
static Dimension getDimension(Object key)
{
System.out.println("UIManager.getDim");
return new Dimension(200,100);
}
/** /**
* Retrieves a font from the defaults table of the current * Retrieves a font from the defaults table of the current
...@@ -189,34 +195,35 @@ public class UIManager implements Serializable ...@@ -189,34 +195,35 @@ public class UIManager implements Serializable
return (Font) getLookAndFeel().getDefaults().get(key); return (Font) getLookAndFeel().getDefaults().get(key);
} }
static Icon getIcon(Object key) static Icon getIcon(Object key)
// Returns an Icon from the defaults table. // Returns an Icon from the defaults table.
{ {
return (Icon) getLookAndFeel().getDefaults().get(key); return (Icon) getLookAndFeel().getDefaults().get(key);
} }
static Insets getInsets(Object key)
// Returns an Insets object from the defaults table. static Insets getInsets(Object key)
{ // Returns an Insets object from the defaults table.
return (Insets) getLookAndFeel().getDefaults().getInsets(key); {
} return (Insets) getLookAndFeel().getDefaults().getInsets(key);
}
static LookAndFeelInfo[] getInstalledLookAndFeels() static LookAndFeelInfo[] getInstalledLookAndFeels()
{ {
return installed; return installed;
} }
static int getInt(Object key) static int getInt(Object key)
{ {
Integer x = (Integer) getLookAndFeel().getDefaults().get(key); Integer x = (Integer) getLookAndFeel().getDefaults().get(key);
if (x == null) if (x == null)
return 0; return 0;
return x.intValue(); return x.intValue();
} }
static LookAndFeel getLookAndFeel()
{
return look_and_feel;
}
static LookAndFeel getLookAndFeel()
{
return look_and_feel;
}
/** /**
* Returns the <code>UIDefaults</code> table of the currently active * Returns the <code>UIDefaults</code> table of the currently active
...@@ -227,73 +234,67 @@ public class UIManager implements Serializable ...@@ -227,73 +234,67 @@ public class UIManager implements Serializable
return getLookAndFeel().getDefaults(); return getLookAndFeel().getDefaults();
} }
static String getString(Object key)
// Returns a string from the defaults table.
{
return (String) getLookAndFeel().getDefaults().get(key);
}
static String getSystemLookAndFeelClassName()
// Returns the name of the LookAndFeel class that implements the native systems look and feel if there is one, otherwise the name of the default cross platform LookAndFeel class.
{
return getCrossPlatformLookAndFeelClassName();
}
static String getString(Object key) public static ComponentUI getUI(JComponent target)
// Returns a string from the defaults table. // Returns the L&F object that renders the target component.
{ {
return (String) getLookAndFeel().getDefaults().get(key); ComponentUI ui = getDefaults().getUI(target);
} //System.out.println("GET-UI-> " + ui + ", for " + target);
static String getSystemLookAndFeelClassName() return ui;
// Returns the name of the LookAndFeel class that implements the native systems look and feel if there is one, otherwise the name of the default cross platform LookAndFeel class. }
{
return getCrossPlatformLookAndFeelClassName();
}
public static void installLookAndFeel(String name, String className)
// Creates a new look and feel and adds it to the current array.
{
}
public static ComponentUI getUI(JComponent target) public static void installLookAndFeel(LookAndFeelInfo info)
// Returns the L&F object that renders the target component. // Adds the specified look and feel to the current array and then calls setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[]).
{ {
ComponentUI ui = getDefaults().getUI(target); }
//System.out.println("GET-UI-> " + ui + ", for " + target);
return ui;
}
public static Object put(Object key, Object value)
// Stores an object in the defaults table.
{
return getLookAndFeel().getDefaults().put(key,value);
}
public static void installLookAndFeel(String name, String className) public static void setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos)
// Creates a new look and feel and adds it to the current array. // Replaces the current array of installed LookAndFeelInfos.
{ {
} }
public static void installLookAndFeel(LookAndFeelInfo info)
// Adds the specified look and feel to the current array and then calls setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[]). public static void setLookAndFeel(LookAndFeel newLookAndFeel)
{ {
} if (look_and_feel != null)
public static Object put(Object key, Object value) look_and_feel.uninitialize();
// Stores an object in the defaults table.
{
return getLookAndFeel().getDefaults().put(key,value);
}
public static void removePropertyChangeListener(PropertyChangeListener listener)
// Remove a PropertyChangeListener from the listener list.
{
}
public static void setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos)
// Replaces the current array of installed LookAndFeelInfos.
{
}
public static void setLookAndFeel(LookAndFeel newLookAndFeel)
{
if (look_and_feel != null)
look_and_feel.uninitialize();
// Set the current default look and feel using a LookAndFeel object. // Set the current default look and feel using a LookAndFeel object.
look_and_feel = newLookAndFeel; look_and_feel = newLookAndFeel;
look_and_feel.initialize(); look_and_feel.initialize();
// revalidate(); //revalidate();
// repaint(); //repaint();
} }
public static void setLookAndFeel(String className)
throws ClassNotFoundException,
InstantiationException,
IllegalAccessException,
UnsupportedLookAndFeelException
{
// Set the current default look and feel using a class name.
Class c = Class.forName(className);
LookAndFeel a = (LookAndFeel) c.newInstance(); // throws class-cast-exception
setLookAndFeel(a);
}
public static void setLookAndFeel (String className)
throws ClassNotFoundException, InstantiationException, IllegalAccessException,
UnsupportedLookAndFeelException
{
// Set the current default look and feel using a class name.
Class c = Class.forName(className);
LookAndFeel a = (LookAndFeel) c.newInstance(); // throws class-cast-exception
setLookAndFeel(a);
}
} }
...@@ -52,90 +52,90 @@ import javax.swing.event.EventListenerList; ...@@ -52,90 +52,90 @@ import javax.swing.event.EventListenerList;
public class DefaultColorSelectionModel public class DefaultColorSelectionModel
implements ColorSelectionModel, Serializable implements ColorSelectionModel, Serializable
{ {
static final long serialVersionUID = 580150227676302096L; private static final long serialVersionUID = -8117143602864778804L;
//------------------------------------------------------------- private Color selectedColor;
// Variables --------------------------------------------------
//------------------------------------------------------------- protected transient ChangeEvent changeEvent = new ChangeEvent (this);
protected EventListenerList listenerList = new EventListenerList ();
/**
* changeEvent /**
*/ * Creates a new color selection model.
protected transient ChangeEvent changeEvent; */
public DefaultColorSelectionModel()
/** {
* listenerList this (Color.white);
*/ }
protected EventListenerList listenerList;
/**
/** * Creates a new color selection model with a given selected color.
* selectedColor *
*/ * @param color The selected color.
private Color selectedColor; */
public DefaultColorSelectionModel (Color color)
{
//------------------------------------------------------------- super();
// Initialization --------------------------------------------- this.selectedColor = color;
//------------------------------------------------------------- }
/** /**
* Constructor DefaultColorSelectionModel * Returns the selected color.
*/ *
public DefaultColorSelectionModel() { * @return The selected color.
// TODO */
} // DefaultColorSelectionModel() public Color getSelectedColor()
{
/** return selectedColor;
* Constructor DefaultColorSelectionModel }
* @param color TODO
*/ /**
public DefaultColorSelectionModel(Color color) { * @param color The color to set.
// TODO */
} // DefaultColorSelectionModel() public void setSelectedColor (Color color)
{
this.selectedColor = color;
//------------------------------------------------------------- }
// Methods ----------------------------------------------------
//------------------------------------------------------------- /**
* Adds a listener to this model.
/** *
* getSelectedColor * @param listener The listener to add.
* @returns Color */
*/ public void addChangeListener (ChangeListener listener)
public Color getSelectedColor() { {
return null; // TODO listenerList.add (ChangeListener.class, listener);
} // getSelectedColor() }
/** /**
* setSelectedColor * Removes a listener from this model.
* @param color TODO *
*/ * @param listener The listener to remove.
public void setSelectedColor(Color color) { */
// TODO public void removeChangeListener (ChangeListener listener)
} // setSelectedColor() {
listenerList.remove (ChangeListener.class, listener);
/** }
* addChangeListener
* @param listener TODO /**
*/ * Returns all currently added <code>ChangeListener</code> objects.
public void addChangeListener(ChangeListener listener) { *
// TODO * @return Array of <code>ChangeListener</code> objects.
} // addChangeListener() */
public ChangeListener[] getChangeListeners()
/** {
* removeChangeListener return (ChangeListener[]) listenerList.getListeners (ChangeListener.class);
* @param listener TODO }
*/
public void removeChangeListener(ChangeListener listener) { /**
// TODO * Calls all the <code>stateChanged()</code> method of all added
} // removeChangeListener() * <code>ChangeListener</code> objects with <code>changeEvent</code>
* as argument.
/** */
* fireStateChanged protected void fireStateChanged()
*/ {
protected void fireStateChanged() { ChangeListener[] listeners = getChangeListeners();
// TODO
} // fireStateChanged() for (int i = 0; i < listeners.length; i++)
listeners [i].stateChanged (changeEvent);
}
} // DefaultColorSelectionModel }
...@@ -50,9 +50,9 @@ public class AncestorEvent extends AWTEvent ...@@ -50,9 +50,9 @@ public class AncestorEvent extends AWTEvent
{ {
private static final long serialVersionUID = -8079801679695605002L; private static final long serialVersionUID = -8079801679695605002L;
public static final int ANCESTOR_ADDED = 0; public static final int ANCESTOR_ADDED = 1;
public static final int ANCESTOR_MOVED = 1;
public static final int ANCESTOR_REMOVED = 2; public static final int ANCESTOR_REMOVED = 2;
public static final int ANCESTOR_MOVED = 3;
private JComponent sourceComponent; private JComponent sourceComponent;
private Container ancestor; private Container ancestor;
......
...@@ -81,7 +81,7 @@ public class InternalFrameEvent extends AWTEvent ...@@ -81,7 +81,7 @@ public class InternalFrameEvent extends AWTEvent
/** /**
* Internal frame iconified event * Internal frame iconified event
*/ */
public static final int INTERNAL_FRAME_ICONIFIED = 2552; public static final int INTERNAL_FRAME_ICONIFIED = 25552;
/** /**
* Internal frame last event * Internal frame last event
...@@ -91,7 +91,7 @@ public class InternalFrameEvent extends AWTEvent ...@@ -91,7 +91,7 @@ public class InternalFrameEvent extends AWTEvent
/** /**
* Internal frame opened event * Internal frame opened event
*/ */
public static final int INTERNAL_FRAME_OPENED = 25550; public static final int INTERNAL_FRAME_OPENED = 25549;
/** /**
* Creates a <code>JInternalFrameEvent</code> object. * Creates a <code>JInternalFrameEvent</code> object.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment