private static JPanel createButtonPanel() { JPanel jpanel = new JPanel(); FlowLayout flowLayout = new FlowLayout(); flowLayout.setAlignment(0); jpanel.setLayout(flowLayout); AudioTool.playButton = new JButton("Play"); AudioTool.playButton.setEnabled(true); AudioTool.playButton.addActionListener(new AudioTool_12()); AudioTool.recordButton = new JButton("Record"); AudioTool.recordButton.setEnabled(true); AudioTool.recordButton.addActionListener(AudioTool.recordListener); AudioTool.zoomInButton = new JButton("Zoom In"); AudioTool.zoomInButton.setEnabled(true); AudioTool.zoomInButton.addActionListener(new AudioTool_13()); AudioTool.zoomOutButton = new JButton("Zoom Out"); AudioTool.zoomOutButton.setEnabled(true); AudioTool.zoomOutButton.addActionListener(new AudioTool_14()); AudioTool.zoomResetButton = new JButton("Reset Size"); AudioTool.zoomResetButton.setEnabled(true); AudioTool.zoomResetButton.addActionListener(new AudioTool_15()); JButton jbutton = new JButton("Exit"); jbutton.addActionListener(new AudioTool_16()); jpanel.add(AudioTool.recordButton); jpanel.add(AudioTool.playButton); jpanel.add(AudioTool.zoomInButton); jpanel.add(AudioTool.zoomOutButton); jpanel.add(AudioTool.zoomResetButton); jpanel.add(jbutton); return(jpanel); }
private void initGUI() { try { setPreferredSize(new Dimension(400, 300)); { generalPanel = new JPanel(); FlowLayout generalPanelLayout = new FlowLayout(); generalPanelLayout.setAlignment(FlowLayout.LEFT); generalPanel.setLayout(generalPanelLayout); this.addTab("General", null, generalPanel, null); { resolutionPanel = new JPanel(); generalPanel.add(resolutionPanel); FlowLayout resolutionPanelLayout = new FlowLayout(); resolutionPanel.setLayout(resolutionPanelLayout); resolutionPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "Resolution", TitledBorder.LEADING, TitledBorder.TOP)); { resolutionCheckBox = new JCheckBox(); resolutionPanel.add(resolutionCheckBox); resolutionCheckBox.setText("Override"); } { jLabel1 = new JLabel(); resolutionPanel.add(jLabel1); jLabel1.setText("Image Width:"); } { resolutionXTextField = new JTextField(); resolutionPanel.add(resolutionXTextField); resolutionXTextField.setText("640"); resolutionXTextField.setPreferredSize(new java.awt.Dimension(50, 20)); } { jLabel2 = new JLabel(); resolutionPanel.add(jLabel2); jLabel2.setText("Image Height:"); } { resolutionYTextField = new JTextField(); resolutionPanel.add(resolutionYTextField); resolutionYTextField.setText("480"); resolutionYTextField.setPreferredSize(new java.awt.Dimension(50, 20)); } } { threadsPanel = new JPanel(); generalPanel.add(threadsPanel); threadsPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "Threads", TitledBorder.LEADING, TitledBorder.TOP)); { threadCheckBox = new JCheckBox(); threadsPanel.add(threadCheckBox); threadCheckBox.setText("Use All Processors"); } { jLabel3 = new JLabel(); threadsPanel.add(jLabel3); jLabel3.setText("Threads:"); } { threadTextField = new JTextField(); threadsPanel.add(threadTextField); threadTextField.setText("1"); threadTextField.setPreferredSize(new java.awt.Dimension(50, 20)); } } } { rendererPanel = new JPanel(); FlowLayout rendererPanelLayout = new FlowLayout(); rendererPanelLayout.setAlignment(FlowLayout.LEFT); rendererPanel.setLayout(rendererPanelLayout); this.addTab("Renderer", null, rendererPanel, null); { defaultRendererRadioButton = new JRadioButton(); rendererPanel.add(defaultRendererRadioButton); defaultRendererRadioButton.setText("Default Renderer"); } { bucketRendererPanel = new JPanel(); BoxLayout bucketRendererPanelLayout = new BoxLayout(bucketRendererPanel, javax.swing.BoxLayout.Y_AXIS); bucketRendererPanel.setLayout(bucketRendererPanelLayout); rendererPanel.add(bucketRendererPanel); bucketRendererPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "Bucket Renderer", TitledBorder.LEADING, TitledBorder.TOP)); { bucketRendererRadioButton = new JRadioButton(); bucketRendererPanel.add(bucketRendererRadioButton); bucketRendererRadioButton.setText("Enable"); } { samplingPanel = new JPanel(); GridLayout samplingPanelLayout = new GridLayout(2, 2); samplingPanelLayout.setColumns(2); samplingPanelLayout.setHgap(5); samplingPanelLayout.setVgap(5); samplingPanelLayout.setRows(2); samplingPanel.setLayout(samplingPanelLayout); bucketRendererPanel.add(samplingPanel); { jLabel5 = new JLabel(); samplingPanel.add(jLabel5); jLabel5.setText("Min:"); } { ComboBoxModel minSamplingComboBoxModel = new DefaultComboBoxModel(new string[] { "Item One", "Item Two" }); minSamplingComboBox = new JComboBox(); samplingPanel.add(minSamplingComboBox); minSamplingComboBox.setModel(minSamplingComboBoxModel); } { jLabel6 = new JLabel(); samplingPanel.add(jLabel6); jLabel6.setText("Max:"); } { ComboBoxModel maxSamplingComboxBoxModel = new DefaultComboBoxModel(new string[] { "Item One", "Item Two" }); maxSamplingComboxBox = new JComboBox(); samplingPanel.add(maxSamplingComboxBox); maxSamplingComboxBox.setModel(maxSamplingComboxBoxModel); } } } } } catch (Exception e) { e.printStackTrace(); } }