/** * This method initializes panel1 * * @return java.awt.Panel */ private Panel getPanel1() { if (panel1 == null) { panel1 = new Panel(); panel1.setLayout(null); panel1.setFont(new Font("Arial", Font.BOLD, 12)); panel1.setName(""); panel1.setBounds(new Rectangle(0, 78, 371, 4)); panel1.setBackground(new Color(91, 155, 213)); } return panel1; }
/** * This method initializes PanelExquisiteMembershipLine * * @return java.awt.Panel */ private Panel getPanelExquisiteMembershipLine() { if (PanelExquisiteMembershipLine == null) { PanelExquisiteMembershipLine = new Panel(); PanelExquisiteMembershipLine.setLayout(null); PanelExquisiteMembershipLine.setBounds(new Rectangle(0, 78, 371, 4)); PanelExquisiteMembershipLine.setFont(new Font("Arial", Font.BOLD, 12)); PanelExquisiteMembershipLine.setMinimumSize(new Dimension(300, 4)); PanelExquisiteMembershipLine.setName(""); PanelExquisiteMembershipLine.setBackground(new Color(91, 155, 213)); } return PanelExquisiteMembershipLine; }
/** Constructor for the test program's window. */ public Demo() { super("HardcopyWriter Test"); // Call frame constructor Panel p = new Panel(); // Add a panel to the frame this.add(p, "Center"); // Center it p.setFont( new Font( "SansSerif", // Set a default font Font.BOLD, 18)); print = new Button("Print Test Page"); // Create a Print button quit = new Button("Quit"); // Create a Quit button print.addActionListener(this); // Specify that we'll handle quit.addActionListener(this); // button presses p.add(print); // Add the buttons to the panel p.add(quit); this.pack(); // Set the size of everything }
public RatePlotFileDialogue( int X, int Y, int width, int height, Color fg, Color bg, String title, String text) { this.setLayout(new BorderLayout()); this.setSize(width, height); this.setLocation(X, Y); Label topLabel = new Label(text, Label.CENTER); topLabel.setFont(warnFont); topLabel.setForeground(fg); topLabel.setBackground(bg); Panel midPanel = new Panel(); midPanel.setBackground(bg); midPanel.setLayout(null); midPanel.add(hT); hT.setSize(width, 25); this.setTitle(title); hT.setForeground(fg); hT.setBackground(Color.white); hT.setFont(inputFont); this.add("North", topLabel); this.add("Center", midPanel); // Add Cancel and Save buttons Panel botPanel = new Panel(); botPanel.setBackground(bg); botPanel.setFont(buttonFont); Label label1 = new Label(); Label label2 = new Label(); Label label3 = new Label(); label2.setBackground(bg); label3.setBackground(bg); Button dismissButton = new Button("Cancel"); Button saveButton = new Button("Save"); botPanel.add(dismissButton); botPanel.add(label1); botPanel.add(saveButton); this.add("South", botPanel); this.add("West", label2); this.add("East", label3); // Add inner class event handler for Dismiss button dismissButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { hide(); dispose(); } }); // -- end inner class for Dismiss button processing // Add inner class event handler for postscript Save button saveButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { // Following invokes gp.PSfile() to print the PS // file. Can't invoke this method directly from // here because object gp is not recognized. This // works by declaring // RateGraphicsPad instance gp to be static and then // invoking the static method makePS from RatePlotFrame // to in turn invoke gp.PSfile(file). (Note the use // of the "RatePlotFileDialogue.this" construction to // invoke the "this" reference for the outer class // RatePlotFileDialogue from this anonymous inner class.) // In other applications, the second line of the if // clause would likely require modification to // correspond to the particular classes in use. if (RatePlotFileDialogue.this.hT.getText().length() > 0) { RatePlotFrame.makePS(RatePlotFileDialogue.this.hT.getText()); hide(); dispose(); } else { makeTheWarning( 100, 100, 200, 100, Color.black, Color.lightGray, "Warning", "You must supply a file name!", true, RatePlotFileDialogue.this); return; } } }); // Add window close button (inner class) this.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { hide(); dispose(); } }); }