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,12 +83,16 @@ public class NamingManager ...@@ -83,12 +83,16 @@ 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
("Can't load InitialContextFactory class: "
+ java_naming_factory_initial); + java_naming_factory_initial);
e.setRootCause(exception); e.setRootCause(exception);
throw e; throw e;
......
...@@ -85,7 +85,6 @@ public abstract class AbstractButton extends JComponent ...@@ -85,7 +85,6 @@ public abstract class AbstractButton extends JComponent
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";
/** /**
...@@ -95,10 +94,6 @@ public abstract class AbstractButton extends JComponent ...@@ -95,10 +94,6 @@ public abstract class AbstractButton extends JComponent
extends AccessibleJComponent extends AccessibleJComponent
implements AccessibleAction, AccessibleValue, AccessibleText { implements AccessibleAction, AccessibleValue, AccessibleText {
//-------------------------------------------------------------
// Initialization ---------------------------------------------
//-------------------------------------------------------------
/** /**
* Constructor AccessibleAbstractButton * Constructor AccessibleAbstractButton
* @param component TODO * @param component TODO
...@@ -108,11 +103,6 @@ public abstract class AbstractButton extends JComponent ...@@ -108,11 +103,6 @@ public abstract class AbstractButton extends JComponent
// TODO // TODO
} // AccessibleAbstractButton() } // AccessibleAbstractButton()
//-------------------------------------------------------------
// Methods ----------------------------------------------------
//-------------------------------------------------------------
/** /**
* getAccessibleStateSet * getAccessibleStateSet
* @returns AccessibleStateSet * @returns AccessibleStateSet
...@@ -362,15 +352,6 @@ public abstract class AbstractButton extends JComponent ...@@ -362,15 +352,6 @@ public abstract class AbstractButton extends JComponent
} }
} }
/**********************************************
*
*
* Constructors
*
*
****************/
AbstractButton() AbstractButton()
{ {
this("",null); this("",null);
...@@ -392,81 +373,90 @@ public abstract class AbstractButton extends JComponent ...@@ -392,81 +373,90 @@ public abstract class AbstractButton extends JComponent
updateUI(); // get a proper ui updateUI(); // get a proper ui
} }
/**********************************************
*
*
* Actions etc
*
*
****************/
public ButtonModel getModel() public ButtonModel getModel()
{ return model; } { return model; }
public void setModel(ButtonModel newModel) public void setModel(ButtonModel newModel)
{ model = newModel; } { model = newModel; }
public String getActionCommand() public String getActionCommand()
{ return getModel().getActionCommand(); } { return getModel().getActionCommand(); }
public void setActionCommand(String aCommand) public void setActionCommand(String aCommand)
{ getModel().setActionCommand(aCommand); } { getModel().setActionCommand(aCommand); }
public void addActionListener(ActionListener l) public void addActionListener(ActionListener l)
{ getModel().addActionListener(l); } { getModel().addActionListener(l); }
public void removeActionListener(ActionListener l) public void removeActionListener(ActionListener l)
{ getModel().removeActionListener(l); } { getModel().removeActionListener(l); }
public void addChangeListener(ChangeListener l) public void addChangeListener(ChangeListener l)
{ getModel().addChangeListener(l); } { getModel().addChangeListener(l); }
public void removeChangeListener(ChangeListener l) public void removeChangeListener(ChangeListener l)
{ getModel().removeChangeListener(l); } { getModel().removeChangeListener(l); }
public void addItemListener(ItemListener l) public void addItemListener(ItemListener l)
{ getModel().addItemListener(l); } { getModel().addItemListener(l); }
public void removeItemListener(ItemListener l) public void removeItemListener(ItemListener l)
{ getModel().removeItemListener(l); } { getModel().removeItemListener(l); }
public int getHorizontalAlignment() public int getHorizontalAlignment()
{ return hori_align; } { return hori_align; }
public int getHorizontalTextPosition() public int getHorizontalTextPosition()
{ return hori_text_pos; } { return hori_text_pos; }
public int getVerticalAlignment() public int getVerticalAlignment()
{ return vert_align; } { return vert_align; }
public int getVerticalTextPosition() public int getVerticalTextPosition()
{ return vert_text_pos; } { return vert_text_pos; }
protected void fireItemStateChanged(ItemEvent event) protected void fireItemStateChanged(ItemEvent event)
{ getModel().fireItemStateChanged(event); } {
}
protected void fireStateChanged(ChangeEvent event) protected void fireStateChanged(ChangeEvent event)
{ getModel().fireStateChanged(event); } {
}
protected void fireActionPerformed(ActionEvent event) protected void fireActionPerformed(ActionEvent event)
{ getModel().fireActionPerformed(event); } {
}
public void setVerticalAlignment(int alignment) public void setVerticalAlignment(int alignment)
{ vert_align = alignment; } { vert_align = alignment; }
public void setHorizontalAlignment(int alignment) public void setHorizontalAlignment(int alignment)
{ hori_align = alignment; } { hori_align = alignment; }
public void setVerticalTextPosition(int textPosition) public void setVerticalTextPosition(int textPosition)
{ vert_text_pos = textPosition; } { vert_text_pos = textPosition; }
public void setHorizontalTextPosition(int textPosition) public void setHorizontalTextPosition(int textPosition)
{ hori_text_pos = textPosition; } { hori_text_pos = textPosition; }
public int getMnemonic() public int getMnemonic()
{ return getModel().getMnemonic(); } { return getModel().getMnemonic(); }
public void setMnemonic(char mne) public void setMnemonic(char mne)
{ getModel().setMnemonic(mne); } { getModel().setMnemonic(mne); }
public void setMnemonic(int mne) public void setMnemonic(int mne)
{ getModel().setMnemonic(mne); } { getModel().setMnemonic(mne); }
public void setRolloverEnabled(boolean b) public void setRolloverEnabled(boolean b)
{ getModel().setRollover(b); } { getModel().setRollover(b); }
public boolean isRolloverEnabled() public boolean isRolloverEnabled()
{ return getModel().isRollover(); } { return getModel().isRollover(); }
public boolean isBorderPainted() public boolean isBorderPainted()
{ return paint_border; } { return paint_border; }
public void setBorderPainted(boolean b) public void setBorderPainted(boolean b)
{ {
if (b != paint_border) if (b != paint_border)
...@@ -479,6 +469,7 @@ public abstract class AbstractButton extends JComponent ...@@ -479,6 +469,7 @@ public abstract class AbstractButton extends JComponent
public Action getAction() public Action getAction()
{ return action_taken; } { return action_taken; }
public void setAction(Action a) public void setAction(Action a)
{ {
action_taken = a; action_taken = a;
...@@ -488,12 +479,13 @@ public abstract class AbstractButton extends JComponent ...@@ -488,12 +479,13 @@ public abstract class AbstractButton extends JComponent
public void setSelected(boolean b) public void setSelected(boolean b)
{ getModel().setSelected(b); } { getModel().setSelected(b); }
public boolean isSelected() public boolean isSelected()
{ return getModel().isSelected(); } { return getModel().isSelected(); }
public Icon getIcon() public Icon getIcon()
{ return default_icon; } { return default_icon; }
public void setIcon(Icon defaultIcon) public void setIcon(Icon defaultIcon)
{ {
if (default_icon == defaultIcon) if (default_icon == defaultIcon)
...@@ -503,7 +495,7 @@ public abstract class AbstractButton extends JComponent ...@@ -503,7 +495,7 @@ public abstract class AbstractButton extends JComponent
if (default_icon != null) if (default_icon != null)
{ {
// XXX FIXME - icons do not know their parent // XXX FIXME - icons do not know their parent
// default_icon.setParent(this); // default_icon.setParent(this);
} }
revalidate(); revalidate();
repaint(); repaint();
...@@ -511,10 +503,13 @@ public abstract class AbstractButton extends JComponent ...@@ -511,10 +503,13 @@ public abstract class AbstractButton extends JComponent
public String getText() public String getText()
{ return text; } { return text; }
public void setLabel(String label) public void setLabel(String label)
{ setText(label); } { setText(label); }
public String getLabel() public String getLabel()
{ return getText(); } { return getText(); }
public void setText(String text) public void setText(String text)
{ {
this.text = text; this.text = text;
...@@ -522,9 +517,9 @@ public abstract class AbstractButton extends JComponent ...@@ -522,9 +517,9 @@ public abstract class AbstractButton extends JComponent
repaint(); repaint();
} }
public Insets getMargin() public Insets getMargin()
{ return margin; } { return margin; }
public void setMargin(Insets m) public void setMargin(Insets m)
{ {
margin = m; margin = m;
...@@ -541,6 +536,7 @@ public abstract class AbstractButton extends JComponent ...@@ -541,6 +536,7 @@ public abstract class AbstractButton extends JComponent
public Icon getPressedIcon() public Icon getPressedIcon()
{ return pressed_button; } { return pressed_button; }
public void setPressedIcon(Icon pressedIcon) public void setPressedIcon(Icon pressedIcon)
{ {
pressed_button = pressedIcon; pressed_button = pressedIcon;
...@@ -548,9 +544,9 @@ public abstract class AbstractButton extends JComponent ...@@ -548,9 +544,9 @@ public abstract class AbstractButton extends JComponent
repaint(); repaint();
} }
public Icon getDisabledIcon() public Icon getDisabledIcon()
{ return disabled_button; } { return disabled_button; }
public void setDisabledIcon(Icon disabledIcon) public void setDisabledIcon(Icon disabledIcon)
{ {
disabled_button = disabledIcon; disabled_button = disabledIcon;
...@@ -560,6 +556,7 @@ public abstract class AbstractButton extends JComponent ...@@ -560,6 +556,7 @@ public abstract class AbstractButton extends JComponent
public boolean isFocusPainted() public boolean isFocusPainted()
{ return paint_focus; } { return paint_focus; }
public void setFocusPainted(boolean b) public void setFocusPainted(boolean b)
{ {
boolean old = paint_focus; boolean old = paint_focus;
...@@ -587,11 +584,13 @@ public abstract class AbstractButton extends JComponent ...@@ -587,11 +584,13 @@ public abstract class AbstractButton extends JComponent
// Verify that key is a legal value for the horizontalAlignment properties. // Verify that key is a legal value for the horizontalAlignment properties.
return 0; return 0;
} }
protected int checkVerticalKey(int key, String exception) protected int checkVerticalKey(int key, String exception)
{ {
// Ensures that the key is a valid. // Ensures that the key is a valid.
return 0; 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.
...@@ -610,6 +609,7 @@ public abstract class AbstractButton extends JComponent ...@@ -610,6 +609,7 @@ public abstract class AbstractButton extends JComponent
//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.
...@@ -627,25 +627,23 @@ public abstract class AbstractButton extends JComponent ...@@ -627,25 +627,23 @@ public abstract class AbstractButton extends JComponent
}; };
} }
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. // Returns the rollover icon for the button.
...@@ -657,20 +655,19 @@ public abstract class AbstractButton extends JComponent ...@@ -657,20 +655,19 @@ public abstract class AbstractButton extends JComponent
// Returns the rollover selection icon for the button. // Returns the rollover selection icon for the button.
return null; 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. //Returns an array (length 1) containing the label or null if the button is not selected.
return null; return null;
} }
public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h) 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. //This is overridden to return false if the current Icon's Image is not equal to the passed in Image img.
...@@ -683,27 +680,24 @@ public abstract class AbstractButton extends JComponent ...@@ -683,27 +680,24 @@ public abstract class AbstractButton extends JComponent
return false; return false;
} }
protected void paintBorder(Graphics g) protected void paintBorder(Graphics g)
{ {
// Paint the button's border if BorderPainted property is true. // Paint the button's border if BorderPainted property is true.
if (isBorderPainted()) if (isBorderPainted())
super.paintBorder(g); super.paintBorder(g);
} }
protected String paramString() protected String paramString()
{ {
// Returns a string representation of this AbstractButton. // Returns a string representation of this AbstractButton.
return "AbstractButton"; return "AbstractButton";
} }
public void setContentAreaFilled(boolean b) public void setContentAreaFilled(boolean b)
{ {
//Sets whether the button should paint the content area or leave it transparent. //Sets whether the button should paint the content area or leave it transparent.
} }
public void setDisabledSelectedIcon(Icon disabledSelectedIcon) public void setDisabledSelectedIcon(Icon disabledSelectedIcon)
{ {
// Sets the disabled selection icon for the button. // Sets the disabled selection icon for the button.
...@@ -718,13 +712,11 @@ public abstract class AbstractButton extends JComponent ...@@ -718,13 +712,11 @@ public abstract class AbstractButton extends JComponent
// Sets the rollover selected icon for the button. // Sets the rollover selected icon for the button.
} }
public void setSelectedIcon(Icon selectedIcon) public void setSelectedIcon(Icon selectedIcon)
{ {
// Sets the selected icon for the button. // Sets the selected icon for the button.
} }
public void setUI(ButtonUI ui) public void setUI(ButtonUI ui)
{ // Sets the L&F object that renders this component. { // Sets the L&F object that renders this component.
super.setUI(ui); super.setUI(ui);
...@@ -752,7 +744,6 @@ public abstract class AbstractButton extends JComponent ...@@ -752,7 +744,6 @@ public abstract class AbstractButton extends JComponent
System.out.println("PROCESS-ACTION-EVENT: " + e); System.out.println("PROCESS-ACTION-EVENT: " + e);
} }
protected void processMouseEvent(MouseEvent e) protected void processMouseEvent(MouseEvent e)
{ {
// System.out.println("PROCESS-MOUSE-EVENT: " + e + ", PRESSED-IN-MODEL="+getModel().isPressed()); // System.out.println("PROCESS-MOUSE-EVENT: " + e + ", PRESSED-IN-MODEL="+getModel().isPressed());
......
...@@ -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,8 +58,8 @@ import javax.accessibility.AccessibleStateSet; ...@@ -58,8 +58,8 @@ 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)
...@@ -122,6 +122,7 @@ public class SwingUtilities implements SwingConstants ...@@ -122,6 +122,7 @@ public class SwingUtilities implements SwingConstants
return text; return text;
} }
} }
......
...@@ -50,9 +50,7 @@ import javax.swing.plaf.metal.MetalLookAndFeel; ...@@ -50,9 +50,7 @@ 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;
...@@ -62,32 +60,47 @@ public class UIManager implements Serializable ...@@ -62,32 +60,47 @@ public class UIManager implements Serializable
this.name = name; this.name = name;
this.clazz = clazz; this.clazz = clazz;
} }
String getName() { return name; } String getName() { return name; }
String getClassName() { return clazz; } String getClassName() { return clazz; }
} }
private static final long serialVersionUID = -5547433830339189365L;
static LookAndFeelInfo [] installed = { static LookAndFeelInfo [] installed = {
new LookAndFeelInfo("Metal", new LookAndFeelInfo ("Metal", "javax.swing.plaf.metal.MetalLookAndFeel")
"javax.swing.plaf.metal.MetalLookAndFeel")
}; };
static LookAndFeel[] aux_installed; static LookAndFeel[] aux_installed;
static LookAndFeel look_and_feel = new MetalLookAndFeel(); static LookAndFeel look_and_feel = new MetalLookAndFeel();
public UIManager()
{
// 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
*/
public static PropertyChangeListener[] getPropertyChangeListeners ()
{
// FIXME
throw new Error ("Not implemented");
}
public static void addAuxiliaryLookAndFeel (LookAndFeel l)
{ {
// Add a LookAndFeel to the list of auxiliary look and feels. // Add a LookAndFeel to the list of auxiliary look and feels.
if (aux_installed == null) if (aux_installed == null)
...@@ -98,9 +111,7 @@ public class UIManager implements Serializable ...@@ -98,9 +111,7 @@ public class UIManager implements Serializable
} }
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.length);
aux_installed = T; aux_installed = T;
aux_installed[aux_installed.length-1] = l; aux_installed[aux_installed.length-1] = l;
} }
...@@ -115,11 +126,8 @@ public class UIManager implements Serializable ...@@ -115,11 +126,8 @@ public class UIManager implements Serializable
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, System.arraycopy (aux_installed, 0, T, 0, aux_installed.length-1);
T, 0,
aux_installed.length-1);
aux_installed = T; aux_installed = T;
return true; return true;
} }
...@@ -130,7 +138,6 @@ public class UIManager implements Serializable ...@@ -130,7 +138,6 @@ public class UIManager implements Serializable
public static LookAndFeel[] getAuxiliaryLookAndFeels() public static LookAndFeel[] getAuxiliaryLookAndFeels()
{ return aux_installed; } { 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); }
...@@ -175,7 +182,6 @@ public class UIManager implements Serializable ...@@ -175,7 +182,6 @@ public class UIManager implements Serializable
return new Dimension(200,100); 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
* LookAndFeel. * LookAndFeel.
...@@ -194,6 +200,7 @@ public class UIManager implements Serializable ...@@ -194,6 +200,7 @@ public class UIManager implements Serializable
{ {
return (Icon) getLookAndFeel().getDefaults().get(key); return (Icon) getLookAndFeel().getDefaults().get(key);
} }
static Insets getInsets(Object key) static Insets getInsets(Object key)
// Returns an Insets object from the defaults table. // Returns an Insets object from the defaults table.
{ {
...@@ -212,12 +219,12 @@ public class UIManager implements Serializable ...@@ -212,12 +219,12 @@ public class UIManager implements Serializable
return 0; return 0;
return x.intValue(); return x.intValue();
} }
static LookAndFeel getLookAndFeel() static LookAndFeel getLookAndFeel()
{ {
return look_and_feel; return look_and_feel;
} }
/** /**
* Returns the <code>UIDefaults</code> table of the currently active * Returns the <code>UIDefaults</code> table of the currently active
* look and feel. * look and feel.
...@@ -227,19 +234,18 @@ public class UIManager implements Serializable ...@@ -227,19 +234,18 @@ public class UIManager implements Serializable
return getLookAndFeel().getDefaults(); return getLookAndFeel().getDefaults();
} }
static String getString(Object key) static String getString(Object key)
// Returns a string from the defaults table. // Returns a string from the defaults table.
{ {
return (String) getLookAndFeel().getDefaults().get(key); return (String) getLookAndFeel().getDefaults().get(key);
} }
static String getSystemLookAndFeelClassName() 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. // 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(); return getCrossPlatformLookAndFeelClassName();
} }
public static ComponentUI getUI(JComponent target) public static ComponentUI getUI(JComponent target)
// Returns the L&F object that renders the target component. // Returns the L&F object that renders the target component.
{ {
...@@ -248,28 +254,27 @@ public class UIManager implements Serializable ...@@ -248,28 +254,27 @@ public class UIManager implements Serializable
return ui; return ui;
} }
public static void installLookAndFeel(String name, String className) public static void installLookAndFeel(String name, String className)
// Creates a new look and feel and adds it to the current array. // Creates a new look and feel and adds it to the current array.
{ {
} }
public static void installLookAndFeel(LookAndFeelInfo info) public static void installLookAndFeel(LookAndFeelInfo info)
// Adds the specified look and feel to the current array and then calls setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[]). // Adds the specified look and feel to the current array and then calls setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[]).
{ {
} }
public static Object put(Object key, Object value) public static Object put(Object key, Object value)
// Stores an object in the defaults table. // Stores an object in the defaults table.
{ {
return getLookAndFeel().getDefaults().put(key,value); 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) public static void setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos)
// Replaces the current array of installed LookAndFeelInfos. // Replaces the current array of installed LookAndFeelInfos.
{ {
} }
public static void setLookAndFeel(LookAndFeel newLookAndFeel) public static void setLookAndFeel(LookAndFeel newLookAndFeel)
{ {
if (look_and_feel != null) if (look_and_feel != null)
...@@ -279,14 +284,12 @@ public class UIManager implements Serializable ...@@ -279,14 +284,12 @@ public class UIManager implements Serializable
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) public static void setLookAndFeel (String className)
throws ClassNotFoundException, throws ClassNotFoundException, InstantiationException, IllegalAccessException,
InstantiationException,
IllegalAccessException,
UnsupportedLookAndFeelException UnsupportedLookAndFeelException
{ {
// Set the current default look and feel using a class name. // Set the current default look and feel using a class name.
...@@ -294,6 +297,4 @@ public class UIManager implements Serializable ...@@ -294,6 +297,4 @@ public class UIManager implements Serializable
LookAndFeel a = (LookAndFeel) c.newInstance(); // throws class-cast-exception LookAndFeel a = (LookAndFeel) c.newInstance(); // throws class-cast-exception
setLookAndFeel(a); 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);
* changeEvent protected EventListenerList listenerList = new EventListenerList ();
*/
protected transient ChangeEvent changeEvent;
/** /**
* listenerList * Creates a new color selection model.
*/ */
protected EventListenerList listenerList; public DefaultColorSelectionModel()
{
this (Color.white);
}
/** /**
* selectedColor * Creates a new color selection model with a given selected color.
*
* @param color The selected color.
*/ */
private Color selectedColor; public DefaultColorSelectionModel (Color color)
{
super();
//------------------------------------------------------------- this.selectedColor = color;
// Initialization --------------------------------------------- }
//-------------------------------------------------------------
/** /**
* Constructor DefaultColorSelectionModel * Returns the selected color.
*
* @return The selected color.
*/ */
public DefaultColorSelectionModel() { public Color getSelectedColor()
// TODO {
} // DefaultColorSelectionModel() return selectedColor;
}
/** /**
* Constructor DefaultColorSelectionModel * @param color The color to set.
* @param color TODO
*/ */
public DefaultColorSelectionModel(Color color) { public void setSelectedColor (Color color)
// TODO {
} // DefaultColorSelectionModel() this.selectedColor = color;
}
//-------------------------------------------------------------
// Methods ----------------------------------------------------
//-------------------------------------------------------------
/**
* getSelectedColor
* @returns Color
*/
public Color getSelectedColor() {
return null; // TODO
} // getSelectedColor()
/** /**
* setSelectedColor * Adds a listener to this model.
* @param color TODO *
* @param listener The listener to add.
*/ */
public void setSelectedColor(Color color) { public void addChangeListener (ChangeListener listener)
// TODO {
} // setSelectedColor() listenerList.add (ChangeListener.class, listener);
}
/** /**
* addChangeListener * Removes a listener from this model.
* @param listener TODO *
* @param listener The listener to remove.
*/ */
public void addChangeListener(ChangeListener listener) { public void removeChangeListener (ChangeListener listener)
// TODO {
} // addChangeListener() listenerList.remove (ChangeListener.class, listener);
}
/** /**
* removeChangeListener * Returns all currently added <code>ChangeListener</code> objects.
* @param listener TODO *
* @return Array of <code>ChangeListener</code> objects.
*/ */
public void removeChangeListener(ChangeListener listener) { public ChangeListener[] getChangeListeners()
// TODO {
} // removeChangeListener() return (ChangeListener[]) listenerList.getListeners (ChangeListener.class);
}
/** /**
* fireStateChanged * Calls all the <code>stateChanged()</code> method of all added
* <code>ChangeListener</code> objects with <code>changeEvent</code>
* as argument.
*/ */
protected void fireStateChanged() { protected void fireStateChanged()
// TODO {
} // fireStateChanged() ChangeListener[] listeners = getChangeListeners();
for (int i = 0; i < listeners.length; i++)
} // DefaultColorSelectionModel listeners [i].stateChanged (changeEvent);
}
}
...@@ -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