List of usage examples for javax.swing GroupLayout GroupLayout
public GroupLayout(Container host)
From source file:se.llbit.chunky.renderer.ui.RenderControls.java
private JPanel buildPostProcessingPane() { exposure.update();/*from www .ja v a 2 s . c o m*/ JLabel postprocessDescLbl = new JLabel( "<html>Post processing affects rendering performance<br>when the preview window is visible"); JLabel postprocessLbl = new JLabel("Post-processing mode:"); for (Postprocess pp : Postprocess.values) { postprocessCB.addItem("" + pp); } updatePostprocessCB(); postprocessCB.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JComboBox source = (JComboBox) e.getSource(); renderMan.scene().setPostprocess(Postprocess.get(source.getSelectedIndex())); } }); JPanel panel = new JPanel(); GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setHorizontalGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup().addGroup(exposure.horizontalGroup(layout)) .addGroup(layout.createSequentialGroup().addComponent(postprocessLbl) .addPreferredGap(ComponentPlacement.RELATED).addComponent(postprocessCB)) .addComponent(postprocessDescLbl)) .addContainerGap()); layout.setVerticalGroup( layout.createSequentialGroup().addContainerGap().addGroup(exposure.verticalGroup(layout)) .addPreferredGap(ComponentPlacement.UNRELATED).addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(postprocessLbl) .addComponent(postprocessCB)) .addPreferredGap(ComponentPlacement.RELATED).addComponent(postprocessDescLbl) .addContainerGap()); return panel; }
From source file:se.llbit.chunky.renderer.ui.RenderControls.java
private JPanel buildGeneralPane() { JLabel canvasSizeLbl = new JLabel("Canvas size:"); JLabel canvasSizeAdvisory = new JLabel("Note: Actual image size may not be the same as the window size!"); canvasSizeCB.setEditable(true);/*w ww. j a v a 2 s.com*/ canvasSizeCB.addItem("400x400"); canvasSizeCB.addItem("1024x768"); canvasSizeCB.addItem("960x540"); canvasSizeCB.addItem("1920x1080"); canvasSizeCB.addActionListener(canvasSizeListener); final JTextField canvasSizeEditor = (JTextField) canvasSizeCB.getEditor().getEditorComponent(); canvasSizeEditor.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { } @Override public void focusGained(FocusEvent e) { canvasSizeEditor.selectAll(); } }); updateCanvasSizeField(); loadSceneBtn.setText("Load Scene"); loadSceneBtn.setIcon(Icon.load.imageIcon()); loadSceneBtn.addActionListener(loadSceneListener); JButton loadSelectedChunksBtn = new JButton("Load Selected Chunks"); loadSelectedChunksBtn.setToolTipText("Load the chunks that are currently selected in the map view"); loadSelectedChunksBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { sceneMan.loadChunks(chunky.getWorld(), chunky.getSelectedChunks()); } }); JButton reloadChunksBtn = new JButton("Reload Chunks"); reloadChunksBtn.setIcon(Icon.reload.imageIcon()); reloadChunksBtn.setToolTipText("Reload all chunks in the scene"); reloadChunksBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { sceneMan.reloadChunks(); } }); openSceneDirBtn.setText("Open Scene Directory"); openSceneDirBtn.setToolTipText("Open the directory where Chunky stores scene descriptions and renders"); openSceneDirBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { try { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().open(context.getSceneDirectory()); } } catch (IOException e) { Log.warn("Failed to open scene directory", e); } } }); openSceneDirBtn.setVisible(Desktop.isDesktopSupported()); loadSceneBtn.setToolTipText("This replaces the current scene!"); JButton setCanvasSizeBtn = new JButton("Apply"); setCanvasSizeBtn.setToolTipText("Set the canvas size to the value in the field"); setCanvasSizeBtn.addActionListener(canvasSizeListener); JButton halveCanvasSizeBtn = new JButton("Halve"); halveCanvasSizeBtn.setToolTipText("Halve the canvas width and height"); halveCanvasSizeBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int width = renderMan.scene().canvasWidth() / 2; int height = renderMan.scene().canvasHeight() / 2; setCanvasSize(width, height); } }); JButton doubleCanvasSizeBtn = new JButton("Double"); doubleCanvasSizeBtn.setToolTipText("Double the canvas width and height"); doubleCanvasSizeBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int width = renderMan.scene().canvasWidth() * 2; int height = renderMan.scene().canvasHeight() * 2; setCanvasSize(width, height); } }); JButton makeDefaultBtn = new JButton("Make Default"); makeDefaultBtn.setToolTipText("Make the current canvas size the default"); makeDefaultBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { PersistentSettings.set3DCanvasSize(renderMan.scene().canvasWidth(), renderMan.scene().canvasHeight()); } }); JSeparator sep1 = new JSeparator(); JSeparator sep2 = new JSeparator(); biomeColorsCB.setText("enable biome colors"); updateBiomeColorsCB(); saveDumpsCB.setText("save dump once every "); saveDumpsCB.addActionListener(saveDumpsListener); updateSaveDumpsCheckBox(); String[] frequencyStrings = new String[dumpFrequencies.length]; for (int i = 0; i < dumpFrequencies.length; ++i) { frequencyStrings[i] = Integer.toString(dumpFrequencies[i]); } dumpFrequencyCB.setModel(new DefaultComboBoxModel(frequencyStrings)); dumpFrequencyCB.setEditable(true); dumpFrequencyCB.addActionListener(dumpFrequencyListener); updateDumpFrequencyField(); saveSnapshotsCB.addActionListener(saveSnapshotListener); updateSaveSnapshotCheckBox(); yCutoff.update(); JPanel panel = new JPanel(); GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setHorizontalGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup() .addGroup(layout.createSequentialGroup().addComponent(loadSceneBtn) .addPreferredGap(ComponentPlacement.RELATED).addComponent(openSceneDirBtn)) .addGroup(layout.createSequentialGroup().addComponent(loadSelectedChunksBtn) .addPreferredGap(ComponentPlacement.RELATED).addComponent(reloadChunksBtn)) .addComponent(sep1) .addGroup(layout.createSequentialGroup().addComponent(canvasSizeLbl) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(canvasSizeCB, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(setCanvasSizeBtn) .addPreferredGap(ComponentPlacement.RELATED).addComponent(makeDefaultBtn)) .addGroup(layout.createSequentialGroup().addComponent(halveCanvasSizeBtn) .addPreferredGap(ComponentPlacement.RELATED).addComponent(doubleCanvasSizeBtn)) .addComponent(canvasSizeAdvisory).addComponent(sep2).addComponent(biomeColorsCB) .addGroup(layout.createSequentialGroup().addComponent(saveDumpsCB) .addComponent(dumpFrequencyCB, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(dumpFrequencyLbl).addGap(0, 0, Short.MAX_VALUE)) .addComponent(saveSnapshotsCB).addGroup(yCutoff.horizontalGroup(layout))) .addContainerGap()); layout.setVerticalGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup().addComponent(loadSceneBtn).addComponent(openSceneDirBtn)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout .createParallelGroup().addComponent(loadSelectedChunksBtn).addComponent(reloadChunksBtn)) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent( sep1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(canvasSizeLbl) .addComponent(canvasSizeCB, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(setCanvasSizeBtn).addComponent(makeDefaultBtn)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup().addComponent(halveCanvasSizeBtn) .addComponent(doubleCanvasSizeBtn)) .addPreferredGap(ComponentPlacement.RELATED).addComponent(canvasSizeAdvisory) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(sep2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(biomeColorsCB) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(saveDumpsCB) .addComponent(dumpFrequencyCB).addComponent(dumpFrequencyLbl)) .addComponent(saveSnapshotsCB).addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(yCutoff.verticalGroup(layout)).addContainerGap()); return panel; }
From source file:se.llbit.chunky.renderer.ui.RenderControls.java
private JPanel buildLightingPane() { changeSunColorBtn.setIcon(Icon.colors.imageIcon()); changeSunColorBtn.addActionListener(new ActionListener() { @Override/* w w w . ja v a 2 s . co m*/ public void actionPerformed(ActionEvent e) { ColorPicker picker = new ColorPicker(changeSunColorBtn, renderMan.scene().sun().getColor()); picker.addColorListener(new ColorListener() { @Override public void onColorPicked(Vector3d color) { renderMan.scene().sun().setColor(color); } }); } }); directLight.setText("enable sunlight"); directLight.setSelected(renderMan.scene().getDirectLight()); directLight.addActionListener(directLightListener); enableEmitters.setText("enable emitters"); enableEmitters.setSelected(renderMan.scene().getEmittersEnabled()); enableEmitters.addActionListener(emittersListener); emitterIntensity.update(); sunIntensity.update(); skyLight.update(); sunAzimuth.update(); sunAltitude.update(); JPanel panel = new JPanel(); GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setHorizontalGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup().addComponent(directLight).addComponent(enableEmitters) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup().addComponent(skyLight.getLabel()) .addComponent(emitterIntensity.getLabel()).addComponent(sunIntensity.getLabel()) .addComponent(sunAzimuth.getLabel()).addComponent(sunAltitude.getLabel())) .addGroup(layout.createParallelGroup().addComponent(skyLight.getSlider()) .addComponent(emitterIntensity.getSlider()).addComponent(sunIntensity.getSlider()) .addComponent(sunAzimuth.getSlider()).addComponent(sunAltitude.getSlider())) .addGroup(layout.createParallelGroup().addComponent(skyLight.getField()) .addComponent(emitterIntensity.getField()).addComponent(sunIntensity.getField()) .addComponent(sunAzimuth.getField()).addComponent(sunAltitude.getField()))) .addComponent(changeSunColorBtn)).addContainerGap()); layout.setVerticalGroup(layout.createSequentialGroup().addContainerGap() .addGroup(skyLight.verticalGroup(layout)).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(enableEmitters).addPreferredGap(ComponentPlacement.RELATED) .addGroup(emitterIntensity.verticalGroup(layout)).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(directLight).addPreferredGap(ComponentPlacement.RELATED) .addGroup(sunIntensity.verticalGroup(layout)).addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(sunAzimuth.verticalGroup(layout)).addPreferredGap(ComponentPlacement.RELATED) .addGroup(sunAltitude.verticalGroup(layout)).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(changeSunColorBtn).addContainerGap()); return panel; }
From source file:se.llbit.chunky.renderer.ui.RenderControls.java
private JPanel buildSkyPane() { JLabel skyModeLbl = new JLabel("Sky Mode:"); skyModeCB.setModel(new DefaultComboBoxModel(Sky.SkyMode.values())); skyModeCB.addActionListener(skyModeListener); updateSkyMode();//w w w. j a v a2 s. c o m JLabel skymapRotationLbl = new JLabel("Skymap rotation:"); skymapRotationSlider.setMinimum(1); skymapRotationSlider.setMaximum(100); skymapRotationSlider.addChangeListener(skyRotationListener); skymapRotationSlider.setToolTipText("Controls the horizontal rotational offset for the skymap"); JLabel lightProbeRotationLbl = new JLabel("Skymap rotation:"); lightProbeRotationSlider.setMinimum(1); lightProbeRotationSlider.setMaximum(100); lightProbeRotationSlider.addChangeListener(skyRotationListener); lightProbeRotationSlider.setToolTipText("Controls the horizontal rotational offset for the skymap"); JLabel skyboxRotationLbl = new JLabel("Skybox rotation:"); skyboxRotationSlider.setMinimum(1); skyboxRotationSlider.setMaximum(100); skyboxRotationSlider.addChangeListener(skyRotationListener); skyboxRotationSlider.setToolTipText("Controls the horizontal rotational offset for the skymap"); updateSkyRotation(); skyHorizonOffset.update(); cloudSize.update(); cloudXOffset.update(); cloudYOffset.update(); cloudZOffset.update(); JLabel verticalResolutionLbl = new JLabel("Vertical resolution (degrees):"); ButtonGroup verticalResolution = new ButtonGroup(); v90Btn.setSelected(true); v180Btn.setSelected(false); verticalResolution.add(v90Btn); verticalResolution.add(v180Btn); v90Btn.addActionListener(v90Listener); v180Btn.addActionListener(v180Listener); updateVerticalResolution(); simulatedSkyPanel.setBorder(BorderFactory.createTitledBorder("Simulated Sky Settings")); GroupLayout simulatedSkyLayout = new GroupLayout(simulatedSkyPanel); simulatedSkyPanel.setLayout(simulatedSkyLayout); simulatedSkyLayout.setAutoCreateContainerGaps(true); simulatedSkyLayout.setAutoCreateGaps(true); simulatedSkyLayout.setHorizontalGroup(simulatedSkyLayout.createParallelGroup() .addGroup(skyHorizonOffset.horizontalGroup(simulatedSkyLayout))); simulatedSkyLayout.setVerticalGroup(simulatedSkyLayout.createSequentialGroup() .addGroup(skyHorizonOffset.verticalGroup(simulatedSkyLayout))); skymapPanel.setBorder(BorderFactory.createTitledBorder("Skymap Settings")); GroupLayout skymapLayout = new GroupLayout(skymapPanel); skymapPanel.setLayout(skymapLayout); skymapLayout.setAutoCreateContainerGaps(true); skymapLayout.setAutoCreateGaps(true); skymapLayout.setHorizontalGroup(skymapLayout.createParallelGroup().addComponent(loadSkymapBtn) .addGroup(skymapLayout.createSequentialGroup().addComponent(skymapRotationLbl) .addComponent(skymapRotationSlider)) .addGroup(skymapLayout.createSequentialGroup().addComponent(verticalResolutionLbl) .addPreferredGap(ComponentPlacement.RELATED).addComponent(v90Btn) .addPreferredGap(ComponentPlacement.RELATED).addComponent(v180Btn))); skymapLayout.setVerticalGroup(skymapLayout.createSequentialGroup().addComponent(loadSkymapBtn) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(skymapLayout.createParallelGroup(Alignment.BASELINE).addComponent(verticalResolutionLbl) .addComponent(v90Btn).addComponent(v180Btn)) .addPreferredGap(ComponentPlacement.RELATED).addGroup(skymapLayout.createParallelGroup() .addComponent(skymapRotationLbl).addComponent(skymapRotationSlider))); loadSkymapBtn.setText("Load Skymap"); loadSkymapBtn.setToolTipText("Use a panoramic skymap"); loadSkymapBtn.addActionListener(new SkymapTextureLoader(renderMan)); lightProbePanel.setBorder(BorderFactory.createTitledBorder("Spherical Skymap Settings")); GroupLayout lightProbeLayout = new GroupLayout(lightProbePanel); lightProbePanel.setLayout(lightProbeLayout); lightProbeLayout.setAutoCreateContainerGaps(true); lightProbeLayout.setAutoCreateGaps(true); lightProbeLayout.setHorizontalGroup(lightProbeLayout.createParallelGroup().addComponent(loadLightProbeBtn) .addGroup(lightProbeLayout.createSequentialGroup().addComponent(lightProbeRotationLbl) .addComponent(lightProbeRotationSlider))); lightProbeLayout.setVerticalGroup(lightProbeLayout.createSequentialGroup().addComponent(loadLightProbeBtn) .addPreferredGap(ComponentPlacement.RELATED).addGroup(lightProbeLayout.createParallelGroup() .addComponent(lightProbeRotationLbl).addComponent(lightProbeRotationSlider))); loadLightProbeBtn.setText("Load Spherical Skymap"); loadLightProbeBtn.setToolTipText("Select the spherical skymap to use"); loadLightProbeBtn.addActionListener(new SkymapTextureLoader(renderMan)); skyGradientPanel.setBorder(BorderFactory.createTitledBorder("Sky Gradient")); gradientEditor = new GradientEditor(); gradientEditor.addGradientListener(gradientListener); updateSkyGradient(); skyGradientPanel.add(gradientEditor); GroupLayout skyboxLayout = new GroupLayout(skyboxPanel); skyboxPanel.setLayout(skyboxLayout); skyboxPanel.setBorder(BorderFactory.createTitledBorder("Skybox")); JLabel skyboxLbl = new JLabel("Load skybox textures:"); JButton loadUpTexture = new JButton("Up"); loadUpTexture.setToolTipText("Load up texture"); loadUpTexture.setIcon(Icon.skyboxUp.imageIcon()); loadUpTexture.addActionListener(new SkyboxTextureLoader(renderMan, Sky.SKYBOX_UP)); JButton loadDownTexture = new JButton("Down"); loadDownTexture.setToolTipText("Load down texture"); loadDownTexture.setIcon(Icon.skyboxDown.imageIcon()); loadDownTexture.addActionListener(new SkyboxTextureLoader(renderMan, Sky.SKYBOX_DOWN)); JButton loadFrontTexture = new JButton("Front"); loadFrontTexture.setToolTipText("Load front (north) texture"); loadFrontTexture.setIcon(Icon.skyboxFront.imageIcon()); loadFrontTexture.addActionListener(new SkyboxTextureLoader(renderMan, Sky.SKYBOX_FRONT)); JButton loadBackTexture = new JButton("Back"); loadBackTexture.setToolTipText("Load back (south) texture"); loadBackTexture.setIcon(Icon.skyboxBack.imageIcon()); loadBackTexture.addActionListener(new SkyboxTextureLoader(renderMan, Sky.SKYBOX_BACK)); JButton loadRightTexture = new JButton("Right"); loadRightTexture.setToolTipText("Load right (east) texture"); loadRightTexture.setIcon(Icon.skyboxRight.imageIcon()); loadRightTexture.addActionListener(new SkyboxTextureLoader(renderMan, Sky.SKYBOX_RIGHT)); JButton loadLeftTexture = new JButton("Left"); loadLeftTexture.setToolTipText("Load left (west) texture"); loadLeftTexture.setIcon(Icon.skyboxLeft.imageIcon()); loadLeftTexture.addActionListener(new SkyboxTextureLoader(renderMan, Sky.SKYBOX_LEFT)); skyboxLayout.setAutoCreateContainerGaps(true); skyboxLayout.setAutoCreateGaps(true); skyboxLayout.setHorizontalGroup(skyboxLayout.createParallelGroup() .addGroup(skyboxLayout.createSequentialGroup().addComponent(skyboxLbl) .addGroup(skyboxLayout.createParallelGroup().addComponent(loadUpTexture) .addComponent(loadFrontTexture).addComponent(loadRightTexture)) .addGroup(skyboxLayout.createParallelGroup().addComponent(loadDownTexture) .addComponent(loadBackTexture).addComponent(loadLeftTexture))) .addGroup(skyboxLayout.createSequentialGroup().addComponent(skyboxRotationLbl) .addComponent(skyboxRotationSlider))); skyboxLayout.setVerticalGroup(skyboxLayout.createSequentialGroup().addComponent(skyboxLbl) .addGroup(skyboxLayout.createParallelGroup().addComponent(loadUpTexture) .addComponent(loadDownTexture)) .addGroup(skyboxLayout.createParallelGroup().addComponent(loadFrontTexture) .addComponent(loadBackTexture)) .addGroup(skyboxLayout.createParallelGroup().addComponent(loadRightTexture) .addComponent(loadLeftTexture)) .addGroup(skyboxLayout.createParallelGroup().addComponent(skyboxRotationLbl) .addComponent(skyboxRotationSlider))); atmosphereEnabled.setText("enable atmosphere"); atmosphereEnabled.addActionListener(atmosphereListener); updateAtmosphereCheckBox(); transparentSky.setText("transparent sky"); transparentSky.addActionListener(transparentSkyListener); updateTransparentSky(); volumetricFogEnabled.setText("enable volumetric fog"); volumetricFogEnabled.addActionListener(volumetricFogListener); updateVolumetricFogCheckBox(); cloudsEnabled.setText("enable clouds"); cloudsEnabled.addActionListener(cloudsEnabledListener); updateCloudsEnabledCheckBox(); JPanel panel = new JPanel(); GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setHorizontalGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup() .addGroup(layout.createSequentialGroup().addComponent(skyModeLbl) .addPreferredGap(ComponentPlacement.RELATED).addComponent(skyModeCB, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addComponent(simulatedSkyPanel).addComponent(skymapPanel).addComponent(lightProbePanel) .addComponent(skyGradientPanel).addComponent(skyboxPanel).addComponent(atmosphereEnabled) .addComponent(transparentSky).addComponent(volumetricFogEnabled).addComponent(cloudsEnabled) .addGroup(cloudSize.horizontalGroup(layout)).addGroup(cloudXOffset.horizontalGroup(layout)) .addGroup(cloudYOffset.horizontalGroup(layout)).addGroup(cloudZOffset.horizontalGroup(layout))) .addContainerGap()); layout.setVerticalGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(skyModeLbl) .addComponent(skyModeCB)) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(simulatedSkyPanel) .addComponent(skymapPanel).addComponent(lightProbePanel).addComponent(skyGradientPanel) .addComponent(skyboxPanel).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(atmosphereEnabled).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(transparentSky).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(volumetricFogEnabled).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(cloudsEnabled).addPreferredGap(ComponentPlacement.RELATED) .addGroup(cloudSize.verticalGroup(layout)).addPreferredGap(ComponentPlacement.RELATED) .addGroup(cloudXOffset.verticalGroup(layout)).addPreferredGap(ComponentPlacement.RELATED) .addGroup(cloudYOffset.verticalGroup(layout)).addPreferredGap(ComponentPlacement.RELATED) .addGroup(cloudZOffset.verticalGroup(layout)).addContainerGap()); return panel; }
From source file:se.llbit.chunky.renderer.ui.RenderControls.java
private JPanel buildCameraPane() { JLabel projectionModeLbl = new JLabel("Projection"); fov.update();//from w w w . j a v a2 s. co m dof = new DoFAdjuster(renderMan); dof.update(); subjectDistance.update(); JLabel presetLbl = new JLabel("Preset:"); CameraPreset[] presets = { CameraPreset.NONE, CameraPreset.ISO_WEST_NORTH, CameraPreset.ISO_NORTH_EAST, CameraPreset.ISO_EAST_SOUTH, CameraPreset.ISO_SOUTH_WEST, CameraPreset.SKYBOX_RIGHT, CameraPreset.SKYBOX_LEFT, CameraPreset.SKYBOX_UP, CameraPreset.SKYBOX_DOWN, CameraPreset.SKYBOX_FRONT, CameraPreset.SKYBOX_BACK, }; cameraPreset.setModel(new DefaultComboBoxModel(presets)); cameraPreset.setMaximumRowCount(presets.length); final int presetHeight = cameraPreset.getPreferredSize().height; final int presetWidth = cameraPreset.getPreferredSize().width; cameraPreset.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); label.setPreferredSize(new Dimension(presetWidth, presetHeight)); CameraPreset preset = (CameraPreset) value; label.setIcon(preset.getIcon()); return label; } }); cameraPreset.addActionListener(cameraPresetListener); JLabel customPresetLbl = new JLabel("Custom preset:"); customPreset.setEditable(true); updateCustomPresets(); JButton savePreset = new JButton("save"); savePreset.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String name = ""; int selected = customPreset.getSelectedIndex(); if (selected == -1) { // select name name = (String) customPreset.getEditor().getItem(); name = (name == null) ? "" : name.trim(); if (name.isEmpty()) { // auto-assign name int nextIndex = customPreset.getItemCount() + 1; outer: while (true) { name = "custom-" + (nextIndex++); for (int i = 0; i < customPreset.getItemCount(); ++i) { String item = (String) customPreset.getItemAt(i); if (name.equals(item)) { continue outer; } } break; } } else { for (int i = 0; i < customPreset.getItemCount(); ++i) { String item = (String) customPreset.getItemAt(i); if (name.equals(item)) { selected = i; break; } } } if (selected == -1) { // add new preset selected = customPreset.getItemCount(); customPreset.addItem(name); } customPreset.setSelectedIndex(selected); } else { name = (String) customPreset.getSelectedItem(); } renderMan.scene().saveCameraPreset(name); } }); JButton loadPreset = new JButton("load"); loadPreset.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String name = ""; int selected = customPreset.getSelectedIndex(); if (selected == -1) { // select name name = (String) customPreset.getEditor().getItem(); name = (name == null) ? "" : name.trim(); } else { name = ((String) customPreset.getSelectedItem()).trim(); } if (!name.isEmpty()) { renderMan.scene().loadCameraPreset(name); } } }); JButton deletePreset = new JButton("delete"); deletePreset.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String name = ""; int selected = customPreset.getSelectedIndex(); if (selected == -1) { // select name name = (String) customPreset.getEditor().getItem(); name = (name == null) ? "" : name.trim(); } else { name = ((String) customPreset.getSelectedItem()).trim(); } if (!name.isEmpty()) { renderMan.scene().deleteCameraPreset(name); if (selected != -1) { customPreset.removeItemAt(selected); } else { for (int i = 0; i < customPreset.getItemCount(); ++i) { if (name.equals(customPreset.getItemAt(i))) { customPreset.removeItemAt(i); break; } } } } } }); ProjectionMode[] projectionModes = ProjectionMode.values(); projectionMode.setModel(new DefaultComboBoxModel(projectionModes)); projectionMode.addActionListener(projectionModeListener); updateProjectionMode(); JButton autoFocusBtn = new JButton("Autofocus"); autoFocusBtn.setToolTipText("Focuses on the object right in the center, under the crosshairs"); autoFocusBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { renderMan.scene().autoFocus(); dof.update(); subjectDistance.update(); } }); JButton cameraToPlayerBtn = new JButton("Camera to player"); cameraToPlayerBtn.setToolTipText("Move camera to player position"); cameraToPlayerBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { renderMan.scene().moveCameraToPlayer(); } }); JLabel posLbl = new JLabel("Position:"); cameraX.setColumns(10); cameraX.setHorizontalAlignment(JTextField.RIGHT); cameraX.addActionListener(cameraPositionListener); cameraY.setColumns(10); cameraY.setHorizontalAlignment(JTextField.RIGHT); cameraY.addActionListener(cameraPositionListener); cameraZ.setColumns(10); cameraZ.setHorizontalAlignment(JTextField.RIGHT); cameraZ.addActionListener(cameraPositionListener); updateCameraPosition(); JLabel dirLbl = new JLabel("Direction:"); cameraYaw.setColumns(10); cameraYaw.setHorizontalAlignment(JTextField.RIGHT); cameraYaw.addActionListener(cameraDirectionListener); cameraPitch.setColumns(10); cameraPitch.setHorizontalAlignment(JTextField.RIGHT); cameraPitch.addActionListener(cameraDirectionListener); cameraRoll.setColumns(10); cameraRoll.setHorizontalAlignment(JTextField.RIGHT); cameraRoll.addActionListener(cameraDirectionListener); updateCameraDirection(); JButton centerCameraBtn = new JButton("Center camera"); centerCameraBtn.setToolTipText("Center camera above loaded chunks"); centerCameraBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { renderMan.scene().moveCameraToCenter(); } }); JSeparator sep1 = new JSeparator(); JPanel panel = new JPanel(); GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setHorizontalGroup( layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup().addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup().addComponent(posLbl).addComponent(dirLbl)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup() .addComponent(cameraX, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(cameraYaw, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup() .addComponent(cameraY, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(cameraPitch, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup() .addComponent(cameraZ, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(cameraRoll, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup().addComponent(presetLbl) .addPreferredGap(ComponentPlacement.RELATED).addComponent(cameraPreset)) .addGroup(layout.createSequentialGroup().addComponent(customPresetLbl) .addPreferredGap(ComponentPlacement.RELATED).addComponent(customPreset) .addPreferredGap(ComponentPlacement.RELATED).addComponent(savePreset) .addPreferredGap(ComponentPlacement.RELATED).addComponent(loadPreset) .addPreferredGap(ComponentPlacement.RELATED).addComponent(deletePreset)) .addGroup(layout.createSequentialGroup().addComponent(cameraToPlayerBtn) .addPreferredGap(ComponentPlacement.RELATED).addComponent(centerCameraBtn)) .addComponent(sep1) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup().addComponent(projectionModeLbl) .addComponent(fov.getLabel()).addComponent(dof.getLabel()) .addComponent(subjectDistance.getLabel())) .addGroup(layout.createParallelGroup().addComponent(projectionMode) .addComponent(fov.getSlider()).addComponent(dof.getSlider()) .addComponent(subjectDistance.getSlider())) .addGroup(layout.createParallelGroup().addComponent(fov.getField()) .addComponent(dof.getField()) .addComponent(subjectDistance.getField()))) .addComponent(autoFocusBtn)) .addContainerGap()); layout.setVerticalGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout .createParallelGroup(Alignment.BASELINE).addComponent(presetLbl).addComponent(cameraPreset)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(customPresetLbl) .addComponent(customPreset).addComponent(savePreset).addComponent(loadPreset) .addComponent(deletePreset)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(posLbl).addComponent(cameraX) .addComponent(cameraY).addComponent(cameraZ)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(dirLbl) .addComponent(cameraYaw).addComponent(cameraPitch).addComponent(cameraRoll)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup( layout.createParallelGroup().addComponent(cameraToPlayerBtn).addComponent(centerCameraBtn)) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent( sep1, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(projectionModeLbl) .addComponent(projectionMode)) .addPreferredGap(ComponentPlacement.RELATED).addGroup(fov.verticalGroup(layout)) .addGroup(dof.verticalGroup(layout)).addGroup(subjectDistance.verticalGroup(layout)) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(autoFocusBtn).addContainerGap()); return panel; }
From source file:se.llbit.chunky.renderer.ui.RenderControls.java
private JPanel buildHelpPane() { JLabel helpLbl = new JLabel("<html>Render Preview Controls:<br>" + "<b>W</b> move camera forward<br>" + "<b>S</b> move camera backward<br>" + "<b>A</b> strafe camera left<br>" + "<b>D</b> strafe camera right<br>" + "<b>R</b> move camera up<br>" + "<b>F</b> move camera down<br>" + "<b>U</b> toggle fullscreen mode<br>" + "<b>K</b> move camera forward x100<br>" + "<b>J</b> move camera backward x100<br>" + "<br>" + "Holding <b>SHIFT</b> makes the basic movement keys so move 1/10th of the normal distance."); JPanel panel = new JPanel(); GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout);/*from ww w . j a v a2 s .c o m*/ layout.setHorizontalGroup( layout.createSequentialGroup().addContainerGap().addComponent(helpLbl).addContainerGap()); layout.setVerticalGroup( layout.createSequentialGroup().addContainerGap().addComponent(helpLbl).addContainerGap()); return panel; }
From source file:se.llbit.chunky.renderer.ui.tabs.SkyTab.java
public SkyTab(RenderControls renderControls) { super(renderControls); JLabel skyModeLbl = new JLabel("Sky Mode:"); skyModeCB.setModel(new DefaultComboBoxModel(Sky.SkyMode.values())); skyModeCB.addActionListener(skyModeListener); // Need to hide these to not warp the Swing layout: simulatedSkyPanel.setVisible(false); skymapPanel.setVisible(false);//from www . j ava 2s . co m lightProbePanel.setVisible(false); skyGradientPanel.setVisible(false); skyboxPanel.setVisible(false); JLabel skymapRotationLbl = new JLabel("Skymap rotation:"); skymapRotationSlider.setMinimum(1); skymapRotationSlider.setMaximum(100); skymapRotationSlider.addChangeListener(skyRotationListener); skymapRotationSlider.setToolTipText("Controls the horizontal rotational offset for the skymap"); JLabel lightProbeRotationLbl = new JLabel("Skymap rotation:"); lightProbeRotationSlider.setMinimum(1); lightProbeRotationSlider.setMaximum(100); lightProbeRotationSlider.addChangeListener(skyRotationListener); lightProbeRotationSlider.setToolTipText("Controls the horizontal rotational offset for the skymap"); JLabel skyboxRotationLbl = new JLabel("Skybox rotation:"); skyboxRotationSlider.setMinimum(1); skyboxRotationSlider.setMaximum(100); skyboxRotationSlider.addChangeListener(skyRotationListener); skyboxRotationSlider.setToolTipText("Controls the horizontal rotational offset for the skymap"); JLabel verticalResolutionLbl = new JLabel("Vertical resolution (degrees):"); ButtonGroup verticalResolution = new ButtonGroup(); v90Btn.setSelected(true); v180Btn.setSelected(false); verticalResolution.add(v90Btn); verticalResolution.add(v180Btn); v90Btn.addActionListener(v90Listener); v180Btn.addActionListener(v180Listener); simulatedSkyPanel.setBorder(BorderFactory.createTitledBorder("Simulated Sky Settings")); GroupLayout simulatedSkyLayout = new GroupLayout(simulatedSkyPanel); simulatedSkyPanel.setLayout(simulatedSkyLayout); simulatedSkyLayout.setAutoCreateContainerGaps(true); simulatedSkyLayout.setAutoCreateGaps(true); simulatedSkyLayout.setHorizontalGroup(simulatedSkyLayout.createParallelGroup() .addGroup(skyHorizonOffset.horizontalGroup(simulatedSkyLayout))); simulatedSkyLayout.setVerticalGroup(simulatedSkyLayout.createSequentialGroup() .addGroup(skyHorizonOffset.verticalGroup(simulatedSkyLayout))); skymapPanel.setBorder(BorderFactory.createTitledBorder("Skymap Settings")); GroupLayout skymapLayout = new GroupLayout(skymapPanel); skymapPanel.setLayout(skymapLayout); skymapLayout.setAutoCreateContainerGaps(true); skymapLayout.setAutoCreateGaps(true); skymapLayout.setHorizontalGroup(skymapLayout.createParallelGroup().addComponent(loadSkymapBtn) .addGroup(skymapLayout.createSequentialGroup().addComponent(skymapRotationLbl) .addComponent(skymapRotationSlider)) .addGroup(skymapLayout.createSequentialGroup().addComponent(verticalResolutionLbl) .addPreferredGap(ComponentPlacement.RELATED).addComponent(v90Btn) .addPreferredGap(ComponentPlacement.RELATED).addComponent(v180Btn))); skymapLayout.setVerticalGroup(skymapLayout.createSequentialGroup().addComponent(loadSkymapBtn) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(skymapLayout.createParallelGroup(Alignment.BASELINE).addComponent(verticalResolutionLbl) .addComponent(v90Btn).addComponent(v180Btn)) .addPreferredGap(ComponentPlacement.RELATED).addGroup(skymapLayout.createParallelGroup() .addComponent(skymapRotationLbl).addComponent(skymapRotationSlider))); loadSkymapBtn.setText("Load Skymap"); loadSkymapBtn.setToolTipText("Use a panoramic skymap"); loadSkymapBtn.addActionListener(new SkymapTextureLoader(renderMan)); lightProbePanel.setBorder(BorderFactory.createTitledBorder("Spherical Skymap Settings")); GroupLayout lightProbeLayout = new GroupLayout(lightProbePanel); lightProbePanel.setLayout(lightProbeLayout); lightProbeLayout.setAutoCreateContainerGaps(true); lightProbeLayout.setAutoCreateGaps(true); lightProbeLayout.setHorizontalGroup(lightProbeLayout.createParallelGroup().addComponent(loadLightProbeBtn) .addGroup(lightProbeLayout.createSequentialGroup().addComponent(lightProbeRotationLbl) .addComponent(lightProbeRotationSlider))); lightProbeLayout.setVerticalGroup(lightProbeLayout.createSequentialGroup().addComponent(loadLightProbeBtn) .addPreferredGap(ComponentPlacement.RELATED).addGroup(lightProbeLayout.createParallelGroup() .addComponent(lightProbeRotationLbl).addComponent(lightProbeRotationSlider))); loadLightProbeBtn.setText("Load Spherical Skymap"); loadLightProbeBtn.setToolTipText("Select the spherical skymap to use"); loadLightProbeBtn.addActionListener(new SkymapTextureLoader(renderMan)); skyGradientPanel.setBorder(BorderFactory.createTitledBorder("Sky Gradient")); gradientEditor = new GradientEditor(); gradientEditor.addGradientListener(gradientListener); skyGradientPanel.add(gradientEditor); GroupLayout skyboxLayout = new GroupLayout(skyboxPanel); skyboxPanel.setLayout(skyboxLayout); skyboxPanel.setBorder(BorderFactory.createTitledBorder("Skybox")); JLabel skyboxLbl = new JLabel("Load skybox textures:"); JButton loadUpTexture = new JButton("Up"); loadUpTexture.setToolTipText("Load up texture"); loadUpTexture.setIcon(Icon.skyboxUp.imageIcon()); loadUpTexture.addActionListener(new SkyboxTextureLoader(renderMan, Sky.SKYBOX_UP)); JButton loadDownTexture = new JButton("Down"); loadDownTexture.setToolTipText("Load down texture"); loadDownTexture.setIcon(Icon.skyboxDown.imageIcon()); loadDownTexture.addActionListener(new SkyboxTextureLoader(renderMan, Sky.SKYBOX_DOWN)); JButton loadFrontTexture = new JButton("Front"); loadFrontTexture.setToolTipText("Load front (north) texture"); loadFrontTexture.setIcon(Icon.skyboxFront.imageIcon()); loadFrontTexture.addActionListener(new SkyboxTextureLoader(renderMan, Sky.SKYBOX_FRONT)); JButton loadBackTexture = new JButton("Back"); loadBackTexture.setToolTipText("Load back (south) texture"); loadBackTexture.setIcon(Icon.skyboxBack.imageIcon()); loadBackTexture.addActionListener(new SkyboxTextureLoader(renderMan, Sky.SKYBOX_BACK)); JButton loadRightTexture = new JButton("Right"); loadRightTexture.setToolTipText("Load right (east) texture"); loadRightTexture.setIcon(Icon.skyboxRight.imageIcon()); loadRightTexture.addActionListener(new SkyboxTextureLoader(renderMan, Sky.SKYBOX_RIGHT)); JButton loadLeftTexture = new JButton("Left"); loadLeftTexture.setToolTipText("Load left (west) texture"); loadLeftTexture.setIcon(Icon.skyboxLeft.imageIcon()); loadLeftTexture.addActionListener(new SkyboxTextureLoader(renderMan, Sky.SKYBOX_LEFT)); skyboxLayout.setAutoCreateContainerGaps(true); skyboxLayout.setAutoCreateGaps(true); skyboxLayout.setHorizontalGroup(skyboxLayout.createParallelGroup() .addGroup(skyboxLayout.createSequentialGroup().addComponent(skyboxLbl) .addGroup(skyboxLayout.createParallelGroup().addComponent(loadUpTexture) .addComponent(loadFrontTexture).addComponent(loadRightTexture)) .addGroup(skyboxLayout.createParallelGroup().addComponent(loadDownTexture) .addComponent(loadBackTexture).addComponent(loadLeftTexture))) .addGroup(skyboxLayout.createSequentialGroup().addComponent(skyboxRotationLbl) .addComponent(skyboxRotationSlider))); skyboxLayout.setVerticalGroup(skyboxLayout.createSequentialGroup().addComponent(skyboxLbl) .addGroup(skyboxLayout.createParallelGroup().addComponent(loadUpTexture) .addComponent(loadDownTexture)) .addGroup(skyboxLayout.createParallelGroup().addComponent(loadFrontTexture) .addComponent(loadBackTexture)) .addGroup(skyboxLayout.createParallelGroup().addComponent(loadRightTexture) .addComponent(loadLeftTexture)) .addGroup(skyboxLayout.createParallelGroup().addComponent(skyboxRotationLbl) .addComponent(skyboxRotationSlider))); transparentSky.setText("transparent sky"); transparentSky.setToolTipText("Disables rendering the skybox"); transparentSky.addActionListener(transparentSkyListener); JLabel fogColorLbl = new JLabel( "<html>Hint: set fog density > 0.1 for thick fog,<br>set it < 0.1 for haze/atmosphere effect"); fogColorBtn.setIcon(Icon.colors.imageIcon()); fogColorBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ColorPicker picker = new ColorPicker(fogColorBtn, renderMan.scene().getFogColor()); picker.addColorListener(new ColorListener() { @Override public void onColorPicked(Vector3d color) { renderMan.scene().setFogColor(color); } }); } }); cloudsEnabled.setText("enable clouds"); cloudsEnabled.addActionListener(cloudsEnabledListener); GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setHorizontalGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup() .addGroup(layout.createSequentialGroup().addComponent(skyModeLbl) .addPreferredGap(ComponentPlacement.RELATED).addComponent(skyModeCB, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addComponent(simulatedSkyPanel).addComponent(skymapPanel).addComponent(lightProbePanel) .addComponent(skyGradientPanel).addComponent(skyboxPanel).addComponent(transparentSky) .addComponent(cloudsEnabled).addGroup(cloudSize.horizontalGroup(layout)) .addGroup(cloudXOffset.horizontalGroup(layout)).addGroup(cloudYOffset.horizontalGroup(layout)) .addGroup(cloudZOffset.horizontalGroup(layout)).addGroup(fogDensity.horizontalGroup(layout)) .addGroup(layout.createSequentialGroup().addComponent(fogColorBtn) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(fogColorLbl))) .addContainerGap()); layout.setVerticalGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(skyModeLbl) .addComponent(skyModeCB)) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(simulatedSkyPanel) .addComponent(skymapPanel).addComponent(lightProbePanel).addComponent(skyGradientPanel) .addComponent(skyboxPanel).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(transparentSky).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(cloudsEnabled).addPreferredGap(ComponentPlacement.RELATED) .addGroup(cloudSize.verticalGroup(layout)).addPreferredGap(ComponentPlacement.RELATED) .addGroup(cloudXOffset.verticalGroup(layout)).addPreferredGap(ComponentPlacement.RELATED) .addGroup(cloudYOffset.verticalGroup(layout)).addPreferredGap(ComponentPlacement.RELATED) .addGroup(cloudZOffset.verticalGroup(layout)).addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(fogDensity.verticalGroup(layout)).addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup().addComponent(fogColorBtn).addComponent(fogColorLbl)) .addContainerGap()); }
From source file:uk.ac.ebi.pride.tools.converter.gui.dialogs.SimplePTMDialog.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license cancelButton = new JButton(); okButton = new JButton(); scrollPane1 = new JScrollPane(); ptmList = new JList(); label1 = new JLabel(); label2 = new JLabel(); massDeltaTextField = new JTextField(); ptmLabelTextField = new JTextField(); label3 = new JLabel(); olsButton = new JButton(); //======== this ======== setTitle("PTM Assignment"); Container contentPane = getContentPane(); //---- cancelButton ---- cancelButton.setText("Cancel"); cancelButton.addActionListener(new ActionListener() { @Override/*from w w w . j a v a2s. c o m*/ public void actionPerformed(ActionEvent e) { cancelButtonActionPerformed(); } }); //---- okButton ---- okButton.setText("OK"); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { okButtonActionPerformed(); } }); //======== scrollPane1 ======== { //---- ptmList ---- ptmList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); ptmList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ptmListMouseClicked(e); } }); scrollPane1.setViewportView(ptmList); } //---- label1 ---- label1.setText("Label"); //---- label2 ---- label2.setText("Mass Delta"); //---- massDeltaTextField ---- massDeltaTextField.setEditable(false); //---- ptmLabelTextField ---- ptmLabelTextField.setEditable(false); //---- label3 ---- label3.setText("Suggested PTMs:"); //---- olsButton ---- olsButton.setText("Search OLS"); olsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { olsButtonActionPerformed(); } }); GroupLayout contentPaneLayout = new GroupLayout(contentPane); contentPane.setLayout(contentPaneLayout); contentPaneLayout.setHorizontalGroup(contentPaneLayout.createParallelGroup().addGroup( GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup().addContainerGap().addGroup(contentPaneLayout .createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(scrollPane1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE) .addGroup(contentPaneLayout.createSequentialGroup().addComponent(olsButton) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 94, Short.MAX_VALUE) .addComponent(okButton, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton)) .addGroup(GroupLayout.Alignment.LEADING, contentPaneLayout.createSequentialGroup() .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(label1).addComponent(label2)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(contentPaneLayout.createParallelGroup() .addComponent(ptmLabelTextField, GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE) .addComponent(massDeltaTextField, GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE))) .addComponent(label3, GroupLayout.Alignment.LEADING)).addContainerGap())); contentPaneLayout.setVerticalGroup(contentPaneLayout.createParallelGroup().addGroup( GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup().addContainerGap() .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(ptmLabelTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(label1)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(label2).addComponent(massDeltaTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(label3) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(cancelButton).addComponent(okButton).addComponent(olsButton)) .addContainerGap())); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:volker.streaming.music.gui.ConfigPanel.java
private void initLayout() { GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(userLabel) .addComponent(pollLabel).addComponent(apiSchemeLabel).addComponent(apiBaseLabel) .addComponent(apiPathLabel).addComponent(apiKeyLabel)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(userField) .addGroup(layout.createSequentialGroup() .addComponent(pollField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(pollEndLabel)) .addComponent(apiSchemeField).addComponent(apiBaseField).addComponent(apiPathField) .addComponent(apiKeyField))) .addComponent(pollErrorLabel).addComponent(advancedViewBox)).addContainerGap()); layout.setVerticalGroup(//from w ww . j a v a 2s . c o m layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(userLabel) .addComponent(userField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(pollLabel) .addComponent(pollField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(pollEndLabel)) .addComponent(pollErrorLabel).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(advancedViewBox).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(apiSchemeLabel).addComponent(apiSchemeField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(apiBaseLabel).addComponent(apiBaseField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(apiPathLabel).addComponent(apiPathField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(apiKeyLabel).addComponent(apiKeyField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap()); updateView(); }
From source file:volker.streaming.music.gui.FormatPanel.java
private void initLayout() { GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(formatLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(formatInfoButton)) .addGroup(layout.createSequentialGroup().addComponent(previewLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(previewField)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(templateLabel).addComponent(formatArea)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(tagLabel).addComponent(tagScrollPane))) .addComponent(nullMessageLabel).addComponent(nullMessageField).addComponent(hline) .addComponent(fileLabel)/*w w w . j a va 2 s . c om*/ .addGroup(layout.createSequentialGroup().addComponent(fileField) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(fileButton))) .addContainerGap()); layout.setVerticalGroup( layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER).addComponent(formatLabel) .addComponent(formatInfoButton)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(previewLabel).addComponent(previewField)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(templateLabel) .addComponent(formatArea)) .addGroup(layout.createSequentialGroup().addComponent(tagLabel) .addComponent(tagScrollPane))) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(nullMessageLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(nullMessageField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(hline, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(fileLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(fileField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(fileButton)) .addContainerGap()); }