import javax.swing.*; import java.awt.*; import java.awt.event.*; public class newPanel4 extends JPanel { AADframe f; String ApplicationName, selectedHost; public newPanel4(AADframe f, String ApplicationName, String host) { this.f = f; this.ApplicationName = ApplicationName; this.selectedHost = host; /* new application card 4 */ GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); setLayout(gridbag); JLabel l11 = new JLabel("Application: "+ApplicationName+" on "+host); addComponent(this,l11,0,0,2,1, GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0); JLabel l15 = new JLabel("Describe output file(s) expected by the application"); addComponent(this,l15,0,1,2,1, GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0); JTextArea ta = new JTextArea(3,25); addComponent(this,ta,0,2,2,1, GridBagConstraints.NONE,GridBagConstraints.CENTER,0); JLabel l16 = new JLabel("If the name of the output file is fixed (a default), enter it here: "); addComponent(this,l16,0,3,2,1, GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0); JTextField outputFile = new JTextField(15); addComponent(this,outputFile,0,4,2,1, GridBagConstraints.NONE,GridBagConstraints.CENTER,0); JButton next1 = new JButton("next input file"); addComponent(this,next1,0,5,1,1, GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0); ActionListener b1 = new ActionListener() { public void actionPerformed(ActionEvent ev) { showCard("enterOutput"); } }; next1.addActionListener(b1); JButton next2 = new JButton("done with output files"); addComponent(this,next2,1,5,GridBagConstraints.REMAINDER,1, GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0); ActionListener b2 = new ActionListener() { public void actionPerformed(ActionEvent ev) { //showCard("enterOutput"); } }; next2.addActionListener(b2); } public void addComponent(java.awt.Container container, Component component, int gridx, int gridy, int gridwidth, int gridheight, int fill, int anchor, int weight) { LayoutManager lm =container.getLayout(); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = gridx; gbc.gridy = gridy; gbc.gridwidth = gridwidth; gbc.gridheight = gridheight; gbc.fill = fill; gbc.anchor = anchor; if(weight>0) { gbc.weightx=1.0; gbc.weighty=1.0; } container.add(component,gbc); } public void showCard(String what) { if(what.equals("enterOutput")) { JPanel enterOutput = new newPanel4(f, ApplicationName, selectedHost); f.cardPanel.add("enterOutput",enterOutput); } else { JPanel enterInput = new newPanel3(f, ApplicationName, selectedHost); f.cardPanel.add("enterInput",enterInput); } f.showCard(what); } }