Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

I have a problem with JFrame.setDefaultLookAndFeelDecorated(true);

843804Mar 29 2005 — edited Apr 5 2005
Hi
i wants to change this Property of the JFrame. my Code Doesnt work. can any one help me.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class ChgDec extends JFrame implements ActionListener{
	
	JButton b1;
	JPanel p1;	
	public ChgDec(String title){
		super(title);
		p1 = new JPanel();
		setContentPane(p1);
		b1 = new JButton("Decorated true");		
		p1.add(b1);		
		b1.addActionListener(this);		
	}
	public void actionPerformed(ActionEvent ae){
		if (ae.getSource()==b1){
			JFrame.setDefaultLookAndFeelDecorated(!isDefaultLookAndFeelDecorated());			
			System.out.println(isDefaultLookAndFeelDecorated());			
		}		
	}
	public static void main(String args[]){
		ChgDec c = new ChgDec("Swatian Tigers");
		c.setDefaultCloseOperation(EXIT_ON_CLOSE);
		c.setSize(300,200);
		c.setVisible(true);
	}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 3 2005
Added on Mar 29 2005
14 comments
191 views