Java Reference
In-Depth Information
42.
currentManager.setDoubleBufferingEnabled(
false
);
43.
compToPrint.paint(g);
44.
currentManager.setDoubleBufferingEnabled(
true
);
45.
return
(PAGE_EXISTS);
46.
}
47.
}
48.
49.
}
File:
its/Printing/PrintSuitTestFrame.java
1.
package
its.Printing;
2.
3.
import
its.SimpleFrame.SimpleFrame;
4.
import
java.awt.event.ActionEvent;
5.
import
java.awt.event.ActionListener;
6.
import
javax.swing.JButton;
import
javax.swing.JTextArea;
7.
import
java.awt.BorderLayout;
8.
9.
10.
public class
PrintSuitTestFrame
extends
SimpleFrame
implements
ActionListener
11.
{
12.
public
PrintSuitTestFrame() {
13.
JButton button =
new
JButton("Print");
14.
button.addActionListener(
this
);
15.
16.
this
.getContentPane().add(button,BorderLayout.SOUTH);
17.
JTextArea textPane =
new
JTextArea();
textPane.setText("Test test
\
n test test
\
n test test
\
n test test");
18.
19.
this
.getContentPane().add(textPane,BorderLayout.CENTER);
20.
}
21.
22.
public void
actionPerformed(ActionEvent evt){
23.
PrintSuit.printComponent(
this
);
24.
}
25.
26.
static public void
main(String[] args) {
27.
PrintSuitTestFrame pstf =
new
PrintSuitTestFrame();
28.
pstf.showIt();
29.
}
}
30.
Search WWH ::
Custom Search