Java Drawing DrawTop

Language

JP  US  UK

 

Page Setup Dialog

 H. Jyounishi, Tokyo Japan
 

Frame (Index), No frame                 version:0.3(latest)  

Summary: This page describes the method to setuppageformat.

Relevant major classes of Java SE: java.awt.*, java.awt.geom.*, java.awt.event.*, javax.swing.*, javax.swing.*

Classes on this page: DialogOfPageSetup, PageSetupAction

1. Class DialogOfPageSetup return=>page top

public class DialogOfPageSetup extends JDialog

Display the following dialog to setup the page (the sheet size and orientation).


Figure 1 PageSetup dialog


Field

Description

action

PageSetupAction action

The ActionListener object (PageSetupAction)

pageSizeSpinnerModel

SpinnerListModel pageSizeSpinnerModel

The spinner modes for setting the page size.

landscapeButton

JRadioButton landscapeButton

The button for setting the page orientation.

portraitButton

JRadioButton portraitButton

The button for setting the page orientation.


Method

Description

Constructor

public DialogOfPageSetup()

Sets the following.

super(ObjectTable.getDrawMain(), "Page Setup");
this.setName("DialogOfPageSetup");
this.action=new PageSetupAction(this);
this.addWindowListener(action);

showDialog

public DialogOfPageSetup showDialog()

∙ If the page setup dialog is already opened, this method does nothing.

Whether the dialog is opened or not canbe checked by the by the getMenuComponent of the menuUtil.

∙ Calls the createPagePanelmethod.

∙ Shows the dialog by calling this.setVisible(true).
∙ Registers this object to MenuComponentList by the setMenuComponent of the menuUtil.

createPagePanel

private JPanel createPagePanel()

Processing:

Creates the panel(Figure 1).
Sets the action to the "OK" and "Cancel" buttons.



2. Class PageSetupAction return=>page top

Field

Description

dialog

DialogOfPageSetup dialog

The DialogOfPageSetup object.


Method

Description

Constructor PageSetupAction(DialogOfPageSetup dialog)
Sets the parameter to the field.

actionPerformed

public void actionPerformed(ActionEvent e)

∙ If the "OK" button is pressed, executes the following.

Callsthe pageSetup method of the PageManager and calls the closeDialog.

∙ If the "Cancel" button is pressed, executes the following.

Calls the closeDialog.

closeDialog

private void closeDialog()

Sets invisible to thedialog by the setVisible(false) and removes this dialog from the menuComponentList by the removeMenuComponent of the menuUtil.

windowClosing

public void windowClosing(WindowEvent e)

Calls the closedDialog method.



Copyright (c) 2009-2013
All other trademarks are property of their respective owners.