getDesktopPane().setBackground(color);
list = Tool.findComponent(getDesktopPane(), JPanel.class);
for (int i = 0; i < list.size(); i++)
list.get(i).setBackground(color);
getMainFrame().getContentPane().setBackground(color);
peter
--
"No trees were destroyed in the sending of this message. However,
a large number of electrons were terribly inconvenienced."
Works fine (in dynamic too).
public class DesktopPaneTest {
public static void main(String[] args) {
final JFrame f = new JFrame("Test");
f.setSize(400, 400);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JDesktopPane pane = new JDesktopPane();
pane.setBackground(Color.RED);
pane.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
Color background = pane.getBackground();
int r = 0xFF ^ background.getRed();
int g = 0xFF ^ background.getGreen();
int b = 0xFF ^ background.getBlue();
pane.setBackground(new Color(r, g, b));
}
});
JInternalFrame iframe = new JInternalFrame("Test");
iframe.setBounds(10, 10, 200, 200);
iframe.setVisible(true);
pane.add(iframe);
f.getContentPane().add(pane);
f.setVisible(true);
}
}
It works fine for me. Are you setting the JDesktopPane as the
ContentPane of your JFrame?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class test9 {
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JDesktopPane dp = new JDesktopPane();
dp.setBackground(Color.YELLOW);
f.setContentPane(dp);
f.setSize(400,300);
f.setVisible(true);
}
});
}
}
--
Knute Johnson
email s/nospam/knute/
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
UIManager.put("Desktop.background", new Color(0, 100, 0));
But when the desktop is in use and i want to CHANGE the color nothing
works.
Works fine for me!
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class test9 {
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JDesktopPane dp = new JDesktopPane();
dp.setLayout(new BorderLayout());
dp.setBackground(Color.YELLOW);
f.setContentPane(dp);
JButton b = new JButton("Change Color");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
dp.setBackground(Color.BLUE);
}
});
dp.add(b,BorderLayout.SOUTH);
* JScroll - the scrollable desktop pane for Java.
* Copyright (C) 2003 Tom Tessier
This extends JDesktopPane and add some cool feature the best thing is -
> the desktop has a taskbar and show every JInternalFrame like windows
do.
But in the code there is nothing that deals with colors. After your
example i am sure this packega mess up something but i have no idea
what can go wrong.
* JScroll - the scrollable desktop pane for Java.
* Copyright (C) 2003 Tom Tessier
This extends JDesktopPane and add some cool feature the best thing is -
> the desktop has a taskbar and show every JInternalFrame like windows
do.
But in the code there is nothing that deals with colors. After your
example i am sure this packega mess up something but i have no idea
what can go wrong.
--
* JScroll - the scrollable desktop pane for Java.
* Copyright (C) 2003 Tom Tessier
This extends JDesktopPane and add some cool feature the best thing is -
> the desktop has a taskbar and show every JInternalFrame like windows
do.
But in the code there is nothing that deals with colors. After your
example i am sure this packega mess up something but i have no idea
what can go wrong.
--
You wasted my time and Alexander's time by not giving us that little
detail up front. I don't like that!
JScroll appears not to have been updated in years. The website is dated
2003 and it says that the code has been tested against 1.3.1 and 1.4.1.
1.3 is obsolete and 1.4 will be obsolete this summer.
I do my best to avoid using any third party code for exactly this reason.