Re: How can i change the background color of a visible JDesktopPane



On 12 янв, 23:17, balla.pe...@xxxxxxxxx wrote:
I tried this things but nothing happened ->


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);
}
}
.



Relevant Pages

  • Re: Multithreading / Scalability
    ... int thread_number; ... catch (InterruptedException e) ... public static void main{ ... every increase in threads reduced the number of calculations that could be performed although again not as dramatically as I expected with the increase in number of threads. ...
    (comp.lang.java.programmer)
  • Re: Using java.util.map
    ... public static void main{ ... The problem is not with the Map implemetations but with the handling of the ... In Java you used an imutable one. ... Is is partially the fault of the Java language in not making int a true ...
    (comp.lang.java.advocacy)
  • last version
    ... i'm trying to make it draggable with a slider to set the fonts. ... public static void main ... int fontSize = source.getValue; ... Sometimes I'm in a good mood. ...
    (comp.lang.java.help)
  • Re: last version
    ... public static void main ... JSlider slider = a.getSource; ... int fontSize = source.getValue; ... Sometimes I'm in a good mood. ...
    (comp.lang.java.help)
  • RE: New JDBC 1.2 driver runs slower than JDBC 1.1 driver-- expecte
    ... public static void main ... Driver JDBCDriver = DriverManager.getDriver; ... int iSeqIx = 1; ... SignatureCaptureDT, PersonGID, LastModPersonGID, IsCCmUSer, HasBeenCCMUser" + ...
    (microsoft.public.sqlserver.jdbcdriver)