- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMyPanel.java
More file actions
Latest commit
27 lines (23 loc) · 490 Bytes
/
Copy pathMyPanel.java
File metadata and controls
27 lines (23 loc) · 490 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
importjavax.swing.*;
importjava.awt.*;
classMyPanelextendsJPanel
{
privateintwidth, height;
publicMyPanel(intw, inth)
{
width = w;
height = h;
}
/* this is a nice constructor to do a common task-
* setting the layout immediately after creating the new panel. */
publicMyPanel(intw, inth, inta, intb)
{
width = w;
height = h;
this.setLayout(newGridLayout(a, b));
}
publicDimensiongetPreferredSize()
{
returnnewDimension(width, height);
}
}