Search in sources :

Example 1 with JideLabel

use of com.jidesoft.swing.JideLabel in project WorldPainter by Captain-Chaos.

the class App method createLayerPanel.

private JPanel createLayerPanel() {
    final JPanel layerPanel = new JPanel();
    layerPanel.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.insets = new Insets(1, 1, 1, 1);
    JideLabel label = new JideLabel("Show");
    label.setOrientation(SwingConstants.VERTICAL);
    label.setClockwise(false);
    label.setMinimumSize(label.getPreferredSize());
    constraints.anchor = GridBagConstraints.SOUTH;
    layerPanel.add(label, constraints);
    label = new JideLabel("Solo");
    label.setOrientation(SwingConstants.VERTICAL);
    label.setClockwise(false);
    label.setMinimumSize(label.getPreferredSize());
    layerPanel.add(label, constraints);
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.weightx = 1.0;
    layerPanel.add(new JLabel(), constraints);
    Configuration config = Configuration.getInstance();
    constraints.anchor = GridBagConstraints.WEST;
    constraints.weightx = 0.0;
    List<Component> terrainComponents = createLayerButton(TERRAIN_AS_LAYER, (char) 0, true, false);
    terrainCheckBox = (JCheckBox) terrainComponents.get(0);
    terrainSoloCheckBox = (JCheckBox) terrainComponents.get(1);
    LayoutUtils.addRowOfComponents(layerPanel, constraints, terrainComponents);
    LayoutUtils.addRowOfComponents(layerPanel, constraints, createLayerButton(FLUIDS_AS_LAYER, (char) 0, false, false));
    for (Layer layer : layers) {
        LayoutUtils.addRowOfComponents(layerPanel, constraints, createLayerButton(layer, layer.getMnemonic()));
    }
    if (!config.isEasyMode()) {
        LayoutUtils.addRowOfComponents(layerPanel, constraints, createLayerButton(Populate.INSTANCE, 'p'));
    }
    LayoutUtils.addRowOfComponents(layerPanel, constraints, createLayerButton(ReadOnly.INSTANCE, 'o'));
    disableImportedWorldOperation();
    final JPopupMenu customLayerMenu = createCustomLayerMenu(null);
    final JButton addLayerButton = new JButton(loadScaledIcon("plus"));
    addLayerButton.setToolTipText(strings.getString("add.a.custom.layer"));
    addLayerButton.setMargin(App.BUTTON_INSETS);
    addLayerButton.addActionListener(e -> customLayerMenu.show(layerPanel, addLayerButton.getX() + addLayerButton.getWidth(), addLayerButton.getY()));
    JPanel spacer = new JPanel();
    constraints.gridwidth = 1;
    constraints.weightx = 0.0;
    layerPanel.add(spacer, constraints);
    spacer = new JPanel();
    layerPanel.add(spacer, constraints);
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.weightx = 1.0;
    layerPanel.add(addLayerButton, constraints);
    return layerPanel;
}
Also used : JideLabel(com.jidesoft.swing.JideLabel) TunnelLayer(org.pepsoft.worldpainter.layers.tunnel.TunnelLayer) UndergroundPocketsLayer(org.pepsoft.worldpainter.layers.pockets.UndergroundPocketsLayer) GroundCoverLayer(org.pepsoft.worldpainter.layers.groundcover.GroundCoverLayer) PlantLayer(org.pepsoft.worldpainter.layers.plants.PlantLayer)

Aggregations

JideLabel (com.jidesoft.swing.JideLabel)1 GroundCoverLayer (org.pepsoft.worldpainter.layers.groundcover.GroundCoverLayer)1 PlantLayer (org.pepsoft.worldpainter.layers.plants.PlantLayer)1 UndergroundPocketsLayer (org.pepsoft.worldpainter.layers.pockets.UndergroundPocketsLayer)1 TunnelLayer (org.pepsoft.worldpainter.layers.tunnel.TunnelLayer)1