• Post Reply Bookmark Topic Watch Topic
  • New Topic

Changing Title of Window when Minimized  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
package App.java;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class App extends Frame {
Label message = new Label("");
public static void main(String[] args) {
App myWindow = new App("Find the active window");
myWindow.setSize(250,150);
myWindow.setVisible(true);
}
public App(String title) {
super(title);
setLayout(new BorderLayout());
addWindowListener(
new WindowAdapter() {
public void windowActivated(WindowEvent e) {
message.setBackground(Color.red);
message.setText("I'm active");
}
public void windowDeactivated(WindowEvent e) {
message.setBackground(Color.lightGray);
message.setText("I'm not active");
}
public void windowIconified(WindowEvent e) {
message.setText("I've been crush");
}
public void windowClosing(WindowEvent e) {
System.out.println("I'm toast!");
dispose();
System.exit(0);
}
}
);
setForeground(Color.white);
setFont(new Font("SanSerif", Font.ITALIC, 24));
message.setAlignment(Label.CENTER);
add(message);
}
}
I'm trying to change the title of the window when it's minimized.
I know that you need to use windowIconified() but I cannot seemed to find a statement that will change the title of window when Iconified.
Can someone help me??
Thank you,
-Jon
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setTitle is in the Frame api and, in the JFrame api in the section Methods inherited from class java.awt.Frame
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!