J
Jenny
Hi,
In the link http://www.cadenhead.org/book/java24hours/source/chapter13/ClockFrame.java
it has this code:
import java.awt.*;
import javax.swing.*;
public class ClockFrame extends JFrame {
public ClockFrame() {
super("Clock");
setSize(225, 125);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container pane = getContentPane();
FlowLayout flo = new FlowLayout();
pane.setLayout(flo);
ClockPanel time = new ClockPanel();
pane.add(time);
setContentPane(time);
setVisible(true);
}
public static void main(String[] arguments) {
ClockFrame sal = new ClockFrame();
}
}
Is any difference if I use setContentPane(pane) instead of
setContentPane(time)?
They both work. But I do not understand what they do.
Thank you.
Jenny
In the link http://www.cadenhead.org/book/java24hours/source/chapter13/ClockFrame.java
it has this code:
import java.awt.*;
import javax.swing.*;
public class ClockFrame extends JFrame {
public ClockFrame() {
super("Clock");
setSize(225, 125);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container pane = getContentPane();
FlowLayout flo = new FlowLayout();
pane.setLayout(flo);
ClockPanel time = new ClockPanel();
pane.add(time);
setContentPane(time);
setVisible(true);
}
public static void main(String[] arguments) {
ClockFrame sal = new ClockFrame();
}
}
Is any difference if I use setContentPane(pane) instead of
setContentPane(time)?
They both work. But I do not understand what they do.
Thank you.
Jenny