first commit
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
#BlueJ class context
|
||||
comment0.params=
|
||||
comment0.target=BorderLayoutExample()
|
||||
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ BorderLayoutExample\n
|
||||
comment1.params=
|
||||
comment1.target=void\ makeFrame()
|
||||
comment1.text=\n\ Place\ five\ components\ in\ the\ available\ regions.\n
|
||||
numComments=2
|
@@ -0,0 +1,40 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Illustrate the layout style of a BorderLayout.
|
||||
*
|
||||
* @author David J. Barnes and Michael Kölling
|
||||
* @version 2016.02.29
|
||||
*/
|
||||
public class BorderLayoutExample
|
||||
{
|
||||
private JFrame frame;
|
||||
|
||||
/**
|
||||
* Constructor for objects of class BorderLayoutExample
|
||||
*/
|
||||
public BorderLayoutExample()
|
||||
{
|
||||
makeFrame();
|
||||
}
|
||||
|
||||
/**
|
||||
* Place five components in the available regions.
|
||||
*/
|
||||
private void makeFrame()
|
||||
{
|
||||
frame = new JFrame("BorderLayout Example");
|
||||
|
||||
Container contentPane = frame.getContentPane();
|
||||
contentPane.setLayout(new BorderLayout());
|
||||
contentPane.add(new JButton("north"), BorderLayout.NORTH);
|
||||
contentPane.add(new JButton("south"), BorderLayout.SOUTH);
|
||||
contentPane.add(new JButton("center"), BorderLayout.CENTER);
|
||||
contentPane.add(new JButton("west"), BorderLayout.WEST);
|
||||
contentPane.add(new JButton("east"), BorderLayout.EAST);
|
||||
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
#BlueJ class context
|
||||
comment0.params=
|
||||
comment0.target=BoxLayoutExample()
|
||||
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ BoxLayoutExample\n
|
||||
comment1.params=
|
||||
comment1.target=void\ makeFrame()
|
||||
comment1.text=\n\ Create\ a\ BoxLayout\ and\ place\ five\ components\ within\ it.\n
|
||||
numComments=2
|
@@ -0,0 +1,40 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Illustrate the layout style of a BoxLayout.
|
||||
*
|
||||
* @author David J. Barnes and Michael Kölling
|
||||
* @version 2016.02.29
|
||||
*/
|
||||
public class BoxLayoutExample
|
||||
{
|
||||
private JFrame frame;
|
||||
|
||||
/**
|
||||
* Constructor for objects of class BoxLayoutExample
|
||||
*/
|
||||
public BoxLayoutExample()
|
||||
{
|
||||
makeFrame();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a BoxLayout and place five components within it.
|
||||
*/
|
||||
private void makeFrame()
|
||||
{
|
||||
frame = new JFrame("BoxLayout Example");
|
||||
|
||||
Container contentPane = frame.getContentPane();
|
||||
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
|
||||
contentPane.add(new JButton("first"));
|
||||
contentPane.add(new JButton("second"));
|
||||
contentPane.add(new JButton("the third string is very long"));
|
||||
contentPane.add(new JButton("fourth"));
|
||||
contentPane.add(new JButton("fifth"));
|
||||
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
#BlueJ class context
|
||||
comment0.params=
|
||||
comment0.target=FlowLayoutExample()
|
||||
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ FlowLayoutExample\n
|
||||
comment1.params=
|
||||
comment1.target=void\ makeFrame()
|
||||
comment1.text=\n\ Place\ five\ components\ within\ a\ container\ managed\ by\n\ a\ FlowLayout.\n
|
||||
numComments=2
|
@@ -0,0 +1,41 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Illustrate the layout style of a FlowLayout.
|
||||
*
|
||||
* @author David J. Barnes and Michael Kölling
|
||||
* @version 2016.02.29
|
||||
*/
|
||||
public class FlowLayoutExample
|
||||
{
|
||||
private JFrame frame;
|
||||
|
||||
/**
|
||||
* Constructor for objects of class FlowLayoutExample
|
||||
*/
|
||||
public FlowLayoutExample()
|
||||
{
|
||||
makeFrame();
|
||||
}
|
||||
|
||||
/**
|
||||
* Place five components within a container managed by
|
||||
* a FlowLayout.
|
||||
*/
|
||||
private void makeFrame()
|
||||
{
|
||||
frame = new JFrame("FlowLayout Example");
|
||||
|
||||
Container contentPane = frame.getContentPane();
|
||||
contentPane.setLayout(new FlowLayout());
|
||||
contentPane.add(new JButton("first"));
|
||||
contentPane.add(new JButton("second"));
|
||||
contentPane.add(new JButton("the third string is very long"));
|
||||
contentPane.add(new JButton("fourth"));
|
||||
contentPane.add(new JButton("fifth"));
|
||||
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
#BlueJ class context
|
||||
comment0.params=
|
||||
comment0.target=GridLayoutExample()
|
||||
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ GridLayoutExample\n
|
||||
comment1.params=
|
||||
comment1.target=void\ makeFrame()
|
||||
comment1.text=\n\ Create\ a\ 3x2\ grid\ and\ place\ five\ components\ within\ it.\n
|
||||
numComments=2
|
@@ -0,0 +1,40 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Illustrate the layout style of a GridLayout.
|
||||
*
|
||||
* @author David J. Barnes and Michael Kölling
|
||||
* @version 2016.02.29
|
||||
*/
|
||||
public class GridLayoutExample
|
||||
{
|
||||
private JFrame frame;
|
||||
|
||||
/**
|
||||
* Constructor for objects of class GridLayoutExample
|
||||
*/
|
||||
public GridLayoutExample()
|
||||
{
|
||||
makeFrame();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a 3x2 grid and place five components within it.
|
||||
*/
|
||||
private void makeFrame()
|
||||
{
|
||||
frame = new JFrame("GridLayout Example");
|
||||
|
||||
Container contentPane = frame.getContentPane();
|
||||
contentPane.setLayout(new GridLayout(3, 2));
|
||||
contentPane.add(new JButton("first"));
|
||||
contentPane.add(new JButton("second"));
|
||||
contentPane.add(new JButton("the third string is very long"));
|
||||
contentPane.add(new JButton("fourth"));
|
||||
contentPane.add(new JButton("fifth"));
|
||||
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
12
Semester 1/Programming 1/Java/examples/projects/chapter13/layouts/README.TXT
Executable file
12
Semester 1/Programming 1/Java/examples/projects/chapter13/layouts/README.TXT
Executable file
@@ -0,0 +1,12 @@
|
||||
PROJECT TITLE: layouts
|
||||
|
||||
PURPOSE OF PROJECT: To provide an illustrate of layout options.
|
||||
|
||||
VERSION or DATE: 2016.02.29
|
||||
|
||||
AUTHORS: David J. Barnes and Michael Kölling
|
||||
|
||||
USER INSTRUCTIONS:
|
||||
Create an instance of any of the example classes.
|
||||
Experiment with window resizing to see the effect on
|
||||
component size and arrangement.
|
@@ -0,0 +1,68 @@
|
||||
#BlueJ package file
|
||||
objectbench.height=76
|
||||
objectbench.width=778
|
||||
package.editor.height=407
|
||||
package.editor.width=670
|
||||
package.editor.x=70
|
||||
package.editor.y=80
|
||||
package.numDependencies=0
|
||||
package.numTargets=4
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.editor.height=700
|
||||
readme.editor.width=900
|
||||
readme.editor.x=42
|
||||
readme.editor.y=23
|
||||
target1.editor.height=728
|
||||
target1.editor.width=894
|
||||
target1.editor.x=50
|
||||
target1.editor.y=60
|
||||
target1.height=60
|
||||
target1.name=BorderLayoutExample
|
||||
target1.naviview.expanded=true
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.typeParameters=
|
||||
target1.width=160
|
||||
target1.x=250
|
||||
target1.y=80
|
||||
target2.editor.height=686
|
||||
target2.editor.width=881
|
||||
target2.editor.x=50
|
||||
target2.editor.y=60
|
||||
target2.height=60
|
||||
target2.name=BoxLayoutExample
|
||||
target2.naviview.expanded=true
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.typeParameters=
|
||||
target2.width=160
|
||||
target2.x=110
|
||||
target2.y=170
|
||||
target3.editor.height=734
|
||||
target3.editor.width=834
|
||||
target3.editor.x=50
|
||||
target3.editor.y=60
|
||||
target3.height=60
|
||||
target3.name=FlowLayoutExample
|
||||
target3.naviview.expanded=true
|
||||
target3.showInterface=false
|
||||
target3.type=ClassTarget
|
||||
target3.typeParameters=
|
||||
target3.width=160
|
||||
target3.x=390
|
||||
target3.y=170
|
||||
target4.editor.height=722
|
||||
target4.editor.width=827
|
||||
target4.editor.x=50
|
||||
target4.editor.y=60
|
||||
target4.height=60
|
||||
target4.name=GridLayoutExample
|
||||
target4.naviview.expanded=true
|
||||
target4.showInterface=false
|
||||
target4.type=ClassTarget
|
||||
target4.typeParameters=
|
||||
target4.width=160
|
||||
target4.x=250
|
||||
target4.y=260
|
Reference in New Issue
Block a user