private JPanel getMixerOptionsPanel() { if (mixerOptionsPanel == null) { mixerOptionsPanel = new JPanel(); mixerOptionsPanel.setBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Mixer")); mixerOptionsPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.NONE; c.weightx = 1; c.insets = new Insets(8, 4, 0, 0); mixerOptionsPanel.add(new JLabel("Select mixer:"), c); c.gridy = 1; mixerOptionsPanel.add(getMixerComboBox(), c); c.gridy = 2; mixerOptionsPanel.add(getMixerDefaultButton(), c); c.insets = new Insets(16, 4, 0, 0); c.gridy = 3; mixerOptionsPanel.add(new JLabel("Enable mixer features:"), c); c.insets = new Insets(6, 0, 0, 0); c.gridy = 4; mixerOptionsPanel.add(getEnableMixerVolumeCheckBox(), c); c.insets = new Insets(0, 0, 0, 0); c.gridy = 5; mixerOptionsPanel.add(getEnableMixerPanCheckBox(), c); if (AudioSystem.getMixerInfo().length == 0) { for (Component child : mixerOptionsPanel.getComponents()) { child.setEnabled(false); } } } return mixerOptionsPanel; }
private JPanel getSoundOptionsPanel() { if (soundOptionsPanel == null) { soundOptionsPanel = new JPanel(); soundOptionsPanel.setBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Sound Effects")); soundOptionsPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = 1; c.weightx = 1; c.anchor = GridBagConstraints.NORTHWEST; c.gridwidth = GridBagConstraints.REMAINDER; soundOptionsPanel.add(getEnableSoundCheckBox(), c); soundOptionsPanel.add(getEnableGunshotCheckBox(), c); soundOptionsPanel.add(getEnableBulletHitCheckBox(), c); soundOptionsPanel.add(getEnableRobotDeathCheckBox(), c); soundOptionsPanel.add(getEnableWallCollisionCheckBox(), c); soundOptionsPanel.add(getEnableRobotCollisionCheckBox(), c); c.insets = new Insets(10, 0, 0, 10); c.gridwidth = 1; c.fill = 0; c.weighty = 1; c.weightx = 0; soundOptionsPanel.add(getEnableAllSoundsButton(), c); c.weightx = 1; c.gridwidth = GridBagConstraints.REMAINDER; soundOptionsPanel.add(getDisableAllSoundsButton(), c); if (AudioSystem.getMixerInfo().length == 0) { for (Component child : soundOptionsPanel.getComponents()) { child.setEnabled(false); } } } return soundOptionsPanel; }