JFrame titleBar resize ?

hi,i got 2 file :

satu.java

import java.awt.BorderLayout;

import java.awt.event.WindowAdapter;

import java.awt.event.WindowEvent;

import javax.swing.JFrame;

publicclass satu{

/**

* @param args

*/

publicstaticvoid main(String[] args){

// TODO Auto-generated method stub

JFrame.setDefaultLookAndFeelDecorated(true);

final JFrame appp =new JFrame("TEST ");

appp.setSize(150,180);

appp.setResizable(false);

dua m =new dua(appp);

m.init();

appp.add(m,BorderLayout.CENTER);

appp.setVisible(true);

//appp.setLocationRelativeTo(null);

appp.addWindowListener(new WindowAdapter(){

publicvoid windowClosing(WindowEvent evt){

appp.setVisible(false);

appp.dispose();

}

});

}

}

dua.java

import java.applet.Applet;

import java.awt.Dimension;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFrame;

publicclass duaextends Appletimplements ActionListener{

/**

* @param args

*/

JFrame myframe;

public dua(JFrame sat){

myframe = sat;

}

publicvoid init(){

JButton x =new JButton("Big");

x.addActionListener(this);

add(x);

}

publicvoid actionPerformed(ActionEvent arg0){

// TODO Auto-generated method stub

int newx = myframe.getWidth()+10;

int newy = myframe.getHeight()+10;

myframe.setTitle("X = "+newx+" Y = "+newy);

myframe.setSize(newx,newy);

}

}

the problem is when i clicked the button,the titlebar doesnt resize...what should i add to resize the title bar too ?

thanks.

[3730 byte] By [ox_ten_wingsa] at [2007-10-3 4:34:47]
# 1
If you change thisJFrame.setDefaultLookAndFeelDecorated(true);to thisJFrame.setDefaultLookAndFeelDecorated(false);Is that what you want?
cotton.ma at 2007-7-14 22:38:27 > top of Java-index,Desktop,Core GUI APIs...
# 2
mr cotton....but if i want to use :JFrame.setDefaultLookAndFeelDecorated(true);is there another way ?thanks mr cotton..
ox_ten_wingsa at 2007-7-14 22:38:27 > top of Java-index,Desktop,Core GUI APIs...
# 3
Sorry I have no idea. I am not entirely sure what that does to be honest. I did notice the L&F change. I thought the sizing behaviour bizarre to be honest.I think you're going to have to wait for Camickr or one of the other Swing gurus.
cotton.ma at 2007-7-14 22:38:27 > top of Java-index,Desktop,Core GUI APIs...
# 4
thanks Mr Cotton
ox_ten_wingsa at 2007-7-14 22:38:27 > top of Java-index,Desktop,Core GUI APIs...
# 5
I guess you have to kick out word final when declaring your JFrame appp because it makes it "constant"
hellbindera at 2007-7-14 22:38:27 > top of Java-index,Desktop,Core GUI APIs...
# 6

BACK !!! You have to validate parent frame. This works fine:

import java.awt.BorderLayout;

import java.awt.event.WindowAdapter;

import java.awt.event.WindowEvent;

import java.applet.Applet;

import java.awt.Dimension;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFrame;

public class satu {

public static void main(String[] args) {

JFrame.setDefaultLookAndFeelDecorated(true);

final JFrame appp = new JFrame("TEST ");

appp.setSize(150,180);

appp.setResizable(false);

dua m = new dua(appp);

m.init();

appp.add(m,BorderLayout.CENTER);

appp.setVisible(true);

appp.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

}

}

class dua extends Applet implements ActionListener {

JFrame myframe;

public dua(JFrame sat){

myframe = sat;

}

public void init(){

JButton x = new JButton("Big");

x.addActionListener(this);

add(x);

}

public void actionPerformed(ActionEvent arg0) {

int newx = myframe.getWidth()+10;

int newy = myframe.getHeight()+10;

myframe.setTitle("X = "+newx+" Y = "+newy);

myframe.setSize(newx,newy);

myframe.validate();

}

}

hellbindera at 2007-7-14 22:38:27 > top of Java-index,Desktop,Core GUI APIs...