Example usage for javax.swing BorderFactory createEmptyBorder

List of usage examples for javax.swing BorderFactory createEmptyBorder

Introduction

In this page you can find the example usage for javax.swing BorderFactory createEmptyBorder.

Prototype

public static Border createEmptyBorder(int top, int left, int bottom, int right) 

Source Link

Document

Creates an empty border that takes up space but which does no drawing, specifying the width of the top, left, bottom, and right sides.

Usage

From source file:com.intel.stl.ui.common.view.ChartsView.java

@Override
protected JComponent getMainComponent() {
    if (mainPanel == null) {
        mainPanel = new JPanel(new BorderLayout(0, 0));
        mainPanel.setOpaque(false);//from  w  w  w .java2s. c  om
        mainPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));

        chartPanel = new JumpChartPanel(null);
        chartPanel.setOpaque(false);
        chartPanel.addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent e) {
                chartPanel.setMaximumDrawHeight(e.getComponent().getHeight());
                chartPanel.setMaximumDrawWidth(e.getComponent().getWidth());
                chartPanel.setMinimumDrawWidth(e.getComponent().getWidth());
                chartPanel.setMinimumDrawHeight(e.getComponent().getHeight());
            }
        });
        mainPanel.add(chartPanel, BorderLayout.CENTER);
    }
    return mainPanel;
}

From source file:edu.ku.brc.specify.plugins.latlon.DDDDPanel.java

/**
 * Creates the UI for the panel./*from w  w w  .j  a va2 s.  c  om*/
 * @param colDef the JGoodies column definition
 * @param latCols the number of columns for the latitude control
 * @param lonCols the number of columns for the longitude control
 * @param cbxIndex the column index of the combobox
 * @return return the builder
 */
protected PanelBuilder createUI(final String colDef, final int latCols, final int lonCols, final int cbxIndex,
        final boolean asDDIntegers) {
    latitudeDD = asDDIntegers ? createTextField(Integer.class, latCols, 0, 90, latTFs)
            : createTextField(Double.class, latCols, 0.0, 90.0, latTFs);
    longitudeDD = asDDIntegers ? createTextField(Integer.class, lonCols, 0, 180, lonTFs)
            : createTextField(Double.class, lonCols, 0.0, 180.0, lonTFs);
    textFields.addAll(latTFs);
    textFields.addAll(lonTFs);

    PanelBuilder builder = new PanelBuilder(new FormLayout(colDef, "p, 1px, p, c:p:g"));
    CellConstraints cc = new CellConstraints();

    latitudeDir = createDirComboxbox(true);
    longitudeDir = createDirComboxbox(false);

    JComponent latDir;
    JComponent lonDir;
    if (isViewMode) {
        latitudeDirTxt = new JTextField(2);
        longitudeDirTxt = new JTextField(2);

        setControlSize(latitudeDirTxt);
        setControlSize(longitudeDirTxt);

        ViewFactory.changeTextFieldUIForDisplay(latitudeDirTxt, false);
        ViewFactory.changeTextFieldUIForDisplay(longitudeDirTxt, false);
        latDir = latitudeDirTxt;
        lonDir = longitudeDirTxt;

    } else {
        latDir = latitudeDir;
        lonDir = longitudeDir;
    }

    builder.add(latLabel = createI18NFormLabel("Latitude", SwingConstants.RIGHT), cc.xy(1, 1));
    builder.add(latitudeDD, cc.xy(3, 1));
    builder.add(latDir, cc.xy(cbxIndex, 1));

    builder.add(lonLabel = createI18NFormLabel("Longitude", SwingConstants.RIGHT), cc.xy(1, 3));
    builder.add(longitudeDD, cc.xy(3, 3));
    builder.add(lonDir, cc.xy(cbxIndex, 3));

    builder.setBorder(BorderFactory.createEmptyBorder(4, 2, 0, 2));

    PanelBuilder pb = new PanelBuilder(new FormLayout(colDef, "p, 1px, p, p"), this);

    PanelBuilder txtPanelPB = new PanelBuilder(new FormLayout("5px,p,5px,p,2px,p", "p, 4px, p"));

    latitudeTF = new JTextField(15);
    longitudeTF = new JTextField(15);

    if (!isViewMode) {
        Color bg = getBackground();
        txtPanelPB.add(new VerticalSeparator(bg.darker(), bg.brighter()), cc.xywh(1, 1, 1, 3));
        txtPanelPB.add(latitudeTF, cc.xy(4, 1));
        txtPanelPB.add(createI18NLabel("SOURCE"), cc.xy(6, 1));
        txtPanelPB.add(longitudeTF, cc.xy(4, 3));
        txtPanelPB.add(createI18NLabel("SOURCE"), cc.xy(6, 3));
        txtPanelPB.setBorder(BorderFactory.createEmptyBorder(4, 2, 0, 2));
    }

    latitudeTF.setEditable(false);
    longitudeTF.setEditable(false);

    pb.add(builder.getPanel(), cc.xy(1, 1));
    pb.add(txtPanelPB.getPanel(), cc.xy(3, 1));

    textFields.addAll(latTFs);
    textFields.addAll(lonTFs);

    return builder;
}

From source file:ch.zhaw.simulation.diagram.charteditor.DefaultPlotEditor.java

/**
 * Standard constructor - constructs a panel for editing the properties of
 * the specified plot./*from   ww  w .ja  v a  2  s .  com*/
 * <P>
 * In designing the panel, we need to be aware that subclasses of Plot will
 * need to implement subclasses of PlotPropertyEditPanel - so we need to
 * leave one or two 'slots' where the subclasses can extend the user
 * interface.
 * 
 * @param plot
 *            the plot, which should be changed.
 */
public DefaultPlotEditor(Plot plot) {
    this.plotInsets = plot.getInsets();
    this.backgroundPaintSample = new PaintSample(plot.getBackgroundPaint());
    this.outlineStrokeSample = new StrokeSample(plot.getOutlineStroke());
    this.outlinePaintSample = new PaintSample(plot.getOutlinePaint());
    // Disabled because makes no sense for us
    // if (plot instanceof CategoryPlot) {
    // this.plotOrientation = ((CategoryPlot) plot).getOrientation();
    // } else if (plot instanceof XYPlot) {
    // this.plotOrientation = ((XYPlot) plot).getOrientation();
    // }
    if (plot instanceof CategoryPlot) {
        CategoryItemRenderer renderer = ((CategoryPlot) plot).getRenderer();
        if (renderer instanceof LineAndShapeRenderer) {
            LineAndShapeRenderer r = (LineAndShapeRenderer) renderer;
            this.drawLines = BooleanUtilities.valueOf(r.getBaseLinesVisible());
            this.drawShapes = BooleanUtilities.valueOf(r.getBaseShapesVisible());
        }
    } else if (plot instanceof XYPlot) {
        XYItemRenderer renderer = ((XYPlot) plot).getRenderer();
        if (renderer instanceof StandardXYItemRenderer) {
            StandardXYItemRenderer r = (StandardXYItemRenderer) renderer;
            this.drawLines = BooleanUtilities.valueOf(r.getPlotLines());
            this.drawShapes = BooleanUtilities.valueOf(r.getBaseShapesVisible());
        }
    }

    setLayout(new BorderLayout());

    this.availableStrokeSamples = new StrokeSample[4];
    this.availableStrokeSamples[0] = new StrokeSample(null);
    this.availableStrokeSamples[1] = new StrokeSample(new BasicStroke(1.0f));
    this.availableStrokeSamples[2] = new StrokeSample(new BasicStroke(2.0f));
    this.availableStrokeSamples[3] = new StrokeSample(new BasicStroke(3.0f));

    // create a panel for the settings...
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            plot.getPlotType() + localizationResources.getString(":")));

    JPanel general = new JPanel(new BorderLayout());
    general.setBorder(BorderFactory.createTitledBorder(localizationResources.getString("General")));

    JPanel interior = new JPanel(new LCBLayout(7));
    interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    interior.add(new JLabel(localizationResources.getString("Outline_stroke")));

    DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (StrokeSample s : this.availableStrokeSamples) {
        model.addElement(s.getStroke());
    }
    this.cbOutlineStroke = new JComboBox(model);
    this.cbOutlineStroke.setSelectedItem(this.outlineStrokeSample.getStroke());
    this.cbOutlineStroke.setRenderer(new StrokeComboboxRenderer());

    interior.add(this.cbOutlineStroke);
    interior.add(new JLabel());

    interior.add(new JLabel(localizationResources.getString("Outline_Paint")));
    JButton button = new JButton(localizationResources.getString("Select..."));
    button.setActionCommand("OutlinePaint");
    button.addActionListener(this);
    interior.add(this.outlinePaintSample);
    interior.add(button);

    interior.add(new JLabel(localizationResources.getString("Background_paint")));
    button = new JButton(localizationResources.getString("Select..."));
    button.setActionCommand("BackgroundPaint");
    button.addActionListener(this);
    interior.add(this.backgroundPaintSample);
    interior.add(button);

    // Disabled because makes no sense for us
    // if (this.plotOrientation != null) {
    // boolean isVertical =
    // this.plotOrientation.equals(PlotOrientation.VERTICAL);
    // int index = isVertical ? ORIENTATION_VERTICAL :
    // ORIENTATION_HORIZONTAL;
    // interior.add(new
    // JLabel(localizationResources.getString("Orientation")));
    // this.orientationCombo = new JComboBox(orientationNames);
    // this.orientationCombo.setSelectedIndex(index);
    // this.orientationCombo.setActionCommand("Orientation");
    // this.orientationCombo.addActionListener(this);
    // interior.add(this.orientationCombo);
    // interior.add(new JPanel());
    // }

    if (this.drawLines != null) {
        interior.add(new JLabel(localizationResources.getString("Draw_lines")));
        this.drawLinesCheckBox = new JCheckBox();
        this.drawLinesCheckBox.setSelected(this.drawLines.booleanValue());
        this.drawLinesCheckBox.setActionCommand("DrawLines");
        this.drawLinesCheckBox.addActionListener(this);
        interior.add(new JPanel());
        interior.add(this.drawLinesCheckBox);
    }

    if (this.drawShapes != null) {
        interior.add(new JLabel(localizationResources.getString("Draw_shapes")));
        this.drawShapesCheckBox = new JCheckBox();
        this.drawShapesCheckBox.setSelected(this.drawShapes.booleanValue());
        this.drawShapesCheckBox.setActionCommand("DrawShapes");
        this.drawShapesCheckBox.addActionListener(this);
        interior.add(new JPanel());
        interior.add(this.drawShapesCheckBox);
    }

    general.add(interior, BorderLayout.NORTH);

    JPanel appearance = new JPanel(new BorderLayout());
    appearance.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    appearance.add(general, BorderLayout.NORTH);

    JTabbedPane tabs = new JTabbedPane();
    tabs.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    Axis domainAxis = null;
    if (plot instanceof CategoryPlot) {
        domainAxis = ((CategoryPlot) plot).getDomainAxis();
    } else if (plot instanceof XYPlot) {
        domainAxis = ((XYPlot) plot).getDomainAxis();
    }
    this.domainAxisPropertyPanel = DefaultAxisEditor.getInstance(domainAxis);
    if (this.domainAxisPropertyPanel != null) {
        this.domainAxisPropertyPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        tabs.add(localizationResources.getString("Domain_Axis"), this.domainAxisPropertyPanel);
    }

    Axis rangeAxis = null;
    if (plot instanceof CategoryPlot) {
        rangeAxis = ((CategoryPlot) plot).getRangeAxis();
    } else if (plot instanceof XYPlot) {
        rangeAxis = ((XYPlot) plot).getRangeAxis();
    }

    this.rangeAxisPropertyPanel = DefaultAxisEditor.getInstance(rangeAxis);
    if (this.rangeAxisPropertyPanel != null) {
        this.rangeAxisPropertyPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        tabs.add(localizationResources.getString("Range_Axis"), this.rangeAxisPropertyPanel);
    }

    tabs.add(localizationResources.getString("Appearance"), appearance);
    panel.add(tabs);

    add(panel);
}

From source file:it.unibas.spicygui.vista.JLayeredPaneCorrespondences.java

private void createTrees(IDataSourceProxy source, IDataSourceProxy target) {
    this.sourceSchemaTree = treeGenerator.buildSchemaTree(source);
    this.targetSchemaTree = treeGenerator.buildSchemaTree(target);
    this.scrollSource.setViewportView(this.sourceSchemaTree);
    this.sourceSchemaTree.setBorder((BorderFactory.createEmptyBorder(20, 20, 10, 10)));
    this.scrollTarget.setViewportView(this.targetSchemaTree);
    this.targetSchemaTree.setBorder((BorderFactory.createEmptyBorder(20, 20, 10, 10)));
    Utility.expandAll(sourceSchemaTree);
    Utility.expandAll(targetSchemaTree);
}

From source file:com.intel.stl.ui.monitor.view.PSPortsDetailsPanel.java

protected JPanel createFlowTypePanel() {
    JPanel panel = new JPanel();
    panel.setOpaque(false);//from   ww  w  .j  ava  2s. com
    panel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
    GridBagLayout gridBag = new GridBagLayout();
    panel.setLayout(gridBag);
    GridBagConstraints gc = new GridBagConstraints();

    gc.insets = new Insets(8, 2, 2, 2);
    gc.weighty = 0;
    gc.weightx = 1;
    gc.gridwidth = GridBagConstraints.REMAINDER;
    gc.gridheight = 1;
    flowTypeChartPanel = new ChartPanel(null);
    flowTypeChartPanel.setPreferredSize(new Dimension(80, 60));
    panel.add(flowTypeChartPanel, gc);

    flowNumberLabels = new JLabel[flowTypes.length];
    flowNameLabels = new JLabel[flowTypes.length];
    gc.fill = GridBagConstraints.BOTH;
    gc.insets = new Insets(2, 2, 2, 2);
    for (int i = 0; i < flowTypes.length; i++) {
        gc.weightx = 1;
        gc.gridwidth = 1;
        flowNumberLabels[i] = createNumberLabel();
        panel.add(flowNumberLabels[i], gc);

        gc.weightx = 0;
        gc.gridwidth = GridBagConstraints.REMAINDER;
        flowNameLabels[i] = createNameLabel(flowTypes[i].getName());
        panel.add(flowNameLabels[i], gc);
    }

    return panel;
}

From source file:org.gdms.usm.view.ProgressFrame.java

public ProgressFrame(Step s, boolean modifyThresholds) {
    super("Progress");
    simulation = s;// www  .j a  v  a  2  s  . co  m
    s.registerStepListener(this);
    stepSeconds = new LinkedList<Integer>();

    s.getManager().setModifyThresholds(modifyThresholds);
    s.getManager().setAdvisor(this);

    JPanel statusPanel = new JPanel(new BorderLayout());
    JPanel globalPanel = new JPanel(new SpringLayout());

    //Time elapsed panel
    JPanel timePanel = new JPanel(new BorderLayout(5, 5));
    final JLabel timeLabel = new JLabel("00:00:00", SwingConstants.CENTER);
    timeLabel.setFont(new Font("Serif", Font.BOLD, 45));
    timePanel.add(timeLabel, BorderLayout.SOUTH);
    JLabel elapsed = new JLabel("Time Elapsed :", SwingConstants.CENTER);
    timePanel.add(elapsed, BorderLayout.NORTH);
    statusPanel.add(timePanel, BorderLayout.NORTH);

    ActionListener timerListener = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            totalSeconds++;
            int hours = totalSeconds / 3600;
            String hourss;
            if (hours < 10) {
                hourss = "0" + hours;
            } else {
                hourss = "" + hours;
            }
            int minutes = (totalSeconds % 3600) / 60;
            String minutess;
            if (minutes < 10) {
                minutess = "0" + minutes;
            } else {
                minutess = "" + minutes;
            }
            int seconds = totalSeconds % 60;
            String secondss;
            if (seconds < 10) {
                secondss = "0" + seconds;
            } else {
                secondss = seconds + "";
            }
            timeLabel.setText(hourss + ":" + minutess + ":" + secondss);
        }
    };
    timer = new Timer(1000, timerListener);
    timer.start();

    //Turn progress panel
    JPanel turnPanel = new JPanel(new BorderLayout(5, 5));
    JLabel turnLabel = new JLabel("Current Step :", SwingConstants.CENTER);
    turnPanel.add(turnLabel, BorderLayout.NORTH);
    currentTurn = new JLabel("Init", SwingConstants.CENTER);
    currentTurn.setFont(new Font("Serif", Font.BOLD, 30));
    turnPanel.add(currentTurn, BorderLayout.SOUTH);
    globalPanel.add(turnPanel);

    //Movers panel
    JPanel moversPanel = new JPanel(new BorderLayout(5, 5));
    JLabel moversLabel = new JLabel("Last movers count :", SwingConstants.CENTER);
    moversPanel.add(moversLabel, BorderLayout.NORTH);
    lastMoversCount = new JLabel("Init", SwingConstants.CENTER);
    lastMoversCount.setFont(new Font("Serif", Font.BOLD, 30));
    moversPanel.add(lastMoversCount, BorderLayout.SOUTH);
    globalPanel.add(moversPanel);

    //Initial population panel
    JPanel initPopPanel = new JPanel(new BorderLayout(5, 5));
    JLabel initialPopulationLabel = new JLabel("Initial population :", SwingConstants.CENTER);
    initPopPanel.add(initialPopulationLabel, BorderLayout.NORTH);
    initialPopulationCount = new JLabel("Init", SwingConstants.CENTER);
    initialPopulationCount.setFont(new Font("Serif", Font.BOLD, 30));
    initPopPanel.add(initialPopulationCount, BorderLayout.SOUTH);
    globalPanel.add(initPopPanel);

    //Current population panel
    JPanel curPopPanel = new JPanel(new BorderLayout(5, 5));
    JLabel currentPopulationLabel = new JLabel("Current population :", SwingConstants.CENTER);
    curPopPanel.add(currentPopulationLabel, BorderLayout.NORTH);
    currentPopulation = new JLabel("Init", SwingConstants.CENTER);
    currentPopulation.setFont(new Font("Serif", Font.BOLD, 30));
    curPopPanel.add(currentPopulation, BorderLayout.SOUTH);
    globalPanel.add(curPopPanel);

    //Dead panel
    JPanel deadPanel = new JPanel(new BorderLayout(5, 5));
    JLabel deadLabel = new JLabel("Last death toll :", SwingConstants.CENTER);
    deadPanel.add(deadLabel, BorderLayout.NORTH);
    lastDeathToll = new JLabel("Init", SwingConstants.CENTER);
    lastDeathToll.setFont(new Font("Serif", Font.BOLD, 30));
    deadPanel.add(lastDeathToll, BorderLayout.SOUTH);
    globalPanel.add(deadPanel);

    //Newborn panel
    JPanel newbornPanel = new JPanel(new BorderLayout(5, 5));
    JLabel newbornLabel = new JLabel("Last newborn count :", SwingConstants.CENTER);
    newbornPanel.add(newbornLabel, BorderLayout.NORTH);
    lastNewbornCount = new JLabel("Init", SwingConstants.CENTER);
    lastNewbornCount.setFont(new Font("Serif", Font.BOLD, 30));
    newbornPanel.add(lastNewbornCount, BorderLayout.SOUTH);
    globalPanel.add(newbornPanel);

    SpringUtilities.makeCompactGrid(globalPanel, 3, 2, 5, 5, 20, 10);
    statusPanel.add(globalPanel, BorderLayout.SOUTH);

    add(statusPanel, BorderLayout.WEST);

    //Graph tabbed pane
    JTabbedPane tabbedPane = new JTabbedPane();
    timeChart = new XYSeries("Step time", true, false);
    tabbedPane.addTab("Step time", createChartPanel("Step time", timeChart));
    currentPopulationChart = new XYSeries("Population", true, false);
    tabbedPane.addTab("Population", createChartPanel("Population", currentPopulationChart));
    deathTollChart = new XYSeries("Deaths", true, false);
    tabbedPane.addTab("Deaths", createChartPanel("Deaths", deathTollChart));
    newbornCountChart = new XYSeries("Newborn", true, false);
    tabbedPane.addTab("Newborn", createChartPanel("Newborn", newbornCountChart));
    moversCountChart = new XYSeries("Movers", true, false);
    tabbedPane.addTab("Movers", createChartPanel("Movers", moversCountChart));
    add(tabbedPane, BorderLayout.EAST);

    getRootPane().setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 10));
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    pack();
    setLocationRelativeTo(null);
    setVisible(true);
}

From source file:userinterface.graph.SeriesEditorDialog.java

/** Creates new form GUIConstantsPicker */
private SeriesEditorDialog(GUIPlugin plugin, JFrame parent, JPanel graph, java.util.List<SeriesKey> series) {
    super(parent, "Graph Series Editor", true);
    this.plugin = plugin;
    this.editors = new ArrayList<SeriesEditor>();

    initComponents();/*from  ww w  .jav a 2s  .c  om*/

    AbstractAction cut = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            editors.get(tabbedPane.getSelectedIndex()).cut();
        }
    };
    cut.putValue(Action.LONG_DESCRIPTION, "Cut the current selection to the clipboard");
    //exitAction.putValue(Action.SHORT_DESCRIPTION, "Exit");
    cut.putValue(Action.NAME, "Cut");
    cut.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallCut.png"));
    //cut.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));

    AbstractAction copy = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            editors.get(tabbedPane.getSelectedIndex()).copy();
        }
    };
    copy.putValue(Action.LONG_DESCRIPTION, "Copies the current selection to the clipboard");
    //exitAction.putValue(Action.SHORT_DESCRIPTION, "Exit");
    copy.putValue(Action.NAME, "Copy");
    copy.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallCopy.png"));
    //copy.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));

    AbstractAction paste = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            editors.get(tabbedPane.getSelectedIndex()).paste();
        }
    };
    paste.putValue(Action.LONG_DESCRIPTION, "Pastes the clipboard to the current selection");
    //exitAction.putValue(Action.SHORT_DESCRIPTION, "Exit");
    paste.putValue(Action.NAME, "Paste");
    paste.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallPaste.png"));
    //paste.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));

    AbstractAction delete = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            editors.get(tabbedPane.getSelectedIndex()).delete();
        }
    };
    delete.putValue(Action.LONG_DESCRIPTION, "Deletes the current");
    //exitAction.putValue(Action.SHORT_DESCRIPTION, "Exit");
    delete.putValue(Action.NAME, "Delete");
    delete.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallDelete.png"));

    for (SeriesKey key : series) {
        SeriesSettings settings = null;
        if (graph instanceof Graph)
            settings = ((Graph) graph).getGraphSeries(key);
        if (graph instanceof Histogram)
            settings = ((Histogram) graph).getGraphSeries(key);
        if (graph instanceof Graph3D)
            settings = ((Graph3D) graph).getSeriesSettings();

        Object DataSeries = null;
        if (graph instanceof Graph)
            DataSeries = (PrismXYSeries) ((Graph) graph).getXYSeries(key);
        if (graph instanceof Histogram)
            DataSeries = ((Histogram) graph).getXYSeries(key);
        if (graph instanceof Graph3D)
            DataSeries = ((Graph3D) graph).getScatterSeries();

        SeriesEditor editor = new SeriesEditor(graph, DataSeries, settings, cut, copy, paste, delete);
        editor.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

        tabbedPane.addTab(settings.getSeriesHeading(), editor);
        editors.add(editor);
    }

    this.getRootPane().setDefaultButton(okayButton);

    toolBar.add(cut);
    toolBar.add(copy);
    toolBar.add(paste);
    toolBar.add(delete);

    this.add(toolBar, BorderLayout.NORTH);

    this.cancelled = false;

    super.setBounds(new Rectangle(550, 300));
    setResizable(true);
    setLocationRelativeTo(getParent()); // centre
}

From source file:greenfoot.gui.export.ExportPublishPane.java

/**
 * Build the component./*from   ww  w. j av a 2 s  .  c o  m*/
 */
private void makePane() {
    font = (new JLabel()).getFont().deriveFont(Font.ITALIC, 11.0f);

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setBorder(BorderFactory.createEmptyBorder(12, 12, 0, 12));
    setBackground(backgroundColor);

    add(getHelpBox());
    add(Box.createVerticalStrut(12));

    infoPanel = new JPanel(new BorderLayout(22, 18));
    {
        infoPanel.setAlignmentX(LEFT_ALIGNMENT);
        infoPanel.setBackground(background);

        Border border = BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(),
                BorderFactory.createEmptyBorder(12, 22, 12, 22));
        infoPanel.setBorder(border);

        JLabel text = new JLabel(Config.getString("export.publish.info") + " " + serverName,
                SwingConstants.CENTER);
        text.setForeground(headingColor);
        infoPanel.add(text, BorderLayout.NORTH);

        createScenarioDisplay();
        infoPanel.add(leftPanel, BorderLayout.CENTER);
        infoPanel.add(getTagDisplay(), BorderLayout.EAST);
    }

    add(infoPanel);
    add(Box.createVerticalStrut(16));
    add(getLoginPanel());
    add(Box.createVerticalStrut(10));
}

From source file:edu.ku.brc.af.prefs.PrefsToolbar.java

/**
 * Loads a Section or grouping of Prefs.
 * @param sectionElement the section elemnent
 * @param altName the localized title//from   w w  w. j  a  va2s  . c o m
 */
protected void loadSectionPrefs(final Element sectionElement, final ResourceBundle resBundle) {
    RolloverCommand.setVertGap(2);

    //List<NavBoxButton> btns = new Vector<NavBoxButton>();
    //int totalWidth = 0;
    try {
        List<?> prefs = sectionElement.selectNodes("pref"); //$NON-NLS-1$
        //numPrefs = prefs.size();
        for (Iterator<?> iterPrefs = prefs.iterator(); iterPrefs.hasNext();) {
            org.dom4j.Element pref = (org.dom4j.Element) iterPrefs.next();

            String prefName = pref.attributeValue("name"); //$NON-NLS-1$
            String prefTitle = pref.attributeValue("title"); //$NON-NLS-1$
            String iconPath = pref.attributeValue("icon"); //$NON-NLS-1$
            String panelClass = pref.attributeValue("panelClass"); //$NON-NLS-1$
            String viewSetName = pref.attributeValue("viewsetname"); //$NON-NLS-1$
            String viewName = pref.attributeValue("viewname"); //$NON-NLS-1$
            String hContext = pref.attributeValue("help"); //$NON-NLS-1$

            if (AppContextMgr.isSecurityOn()) {
                PermissionSettings perm = SecurityMgr.getInstance().getPermission("Prefs." + prefName);
                //PermissionSettings.dumpPermissions("Prefs: "+prefName, perm.getOptions());
                if (!perm.canView()) // this means Enabled
                {
                    continue;
                }
            }

            if (StringUtils.isNotEmpty(prefTitle) && StringUtils.isNotEmpty(iconPath)
                    && StringUtils.isNotEmpty(panelClass)) {
                if (resBundle != null) {
                    try {
                        prefTitle = resBundle.getString(prefTitle);

                    } catch (MissingResourceException ex) {
                        log.error("Couldn't find key[" + prefTitle + "]");
                        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(PrefsToolbar.class, ex);
                    }
                }

                ImageIcon icon;
                if (iconPath.startsWith("http") || iconPath.startsWith("file")) //$NON-NLS-1$ //$NON-NLS-2$
                {
                    icon = new ImageIcon(new URL(iconPath));
                } else {
                    icon = IconManager.getImage(iconPath);
                }

                if (icon != null) {
                    if (icon.getIconWidth() > iconSize || icon.getIconHeight() > iconSize) {
                        icon = new ImageIcon(
                                icon.getImage().getScaledInstance(iconSize, iconSize, Image.SCALE_SMOOTH));
                    }
                }
                if (icon == null) {
                    log.error("Icon was created - path[" + iconPath + "]"); //$NON-NLS-1$ //$NON-NLS-2$
                }

                NavBoxButton btn = new NavBoxButton(getResourceString(prefTitle), icon);
                btn.setOpaque(false);
                btn.setVerticalLayout(true);
                btn.setBorder(BorderFactory.createEmptyBorder(4, 4, 2, 4));

                try {
                    Class<?> panelClassObj = Class.forName(panelClass);
                    Component comp = (Component) panelClassObj.newInstance();

                    if (comp instanceof PrefsPanelIFace) {
                        PrefsPanelIFace prefPanel = (PrefsPanelIFace) comp;
                        prefPanel.setName(prefName);
                        prefPanel.setTitle(prefTitle);
                        prefPanel.setHelpContext(hContext);

                        if (!prefPanel.isOKToLoad()
                                || (AppContextMgr.isSecurityOn() && !prefPanel.getPermissions().canView())) {
                            continue;
                        }
                        prefPanel.setPrefsPanelMgr(prefsPanelMgr);
                    }

                    if (panelClassObj == GenericPrefsPanel.class) {
                        if (StringUtils.isNotEmpty(viewSetName) && StringUtils.isNotEmpty(viewName)) {
                            GenericPrefsPanel genericPrefsPanel = (GenericPrefsPanel) comp;
                            genericPrefsPanel.createForm(viewSetName, viewName);

                        } else {
                            log.error(
                                    "ViewSetName[" + viewSetName + "] or ViewName[" + viewName + "] is empty!"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                        }
                    }

                    prefsPanelMgr.addPanel(prefTitle, comp);

                    add(btn.getUIComponent());

                } catch (Exception ex) {
                    edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                    edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(PrefsToolbar.class, ex);
                    log.error(ex); // XXX FIXME
                    ex.printStackTrace();
                }
                btn.addActionListener(new ShowAction(prefTitle, btn));
            }
        }

        if (getComponentCount() > 0) {
            prevBtn = (RolloverCommand) getComponent(0);
            prevBtn.setActive(true);
        }

        /*int aveWidth = totalWidth / btns.size();
        for (NavBoxButton nbb : btns)
        {
        Dimension size = nbb.getPreferredSize();
        if (size.width < aveWidth)
        {
            size.width = aveWidth;
        }
        nbb.setPreferredSize(size);
        nbb.setSize(size);
        } */

    } catch (Exception ex) {
        ex.printStackTrace();
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(PrefsToolbar.class, ex);

        throw new RuntimeException(ex);
    } finally {
        RolloverCommand.setVertGap(0);
    }
}

From source file:org.obiba.onyx.jade.instrument.ricelake.RiceLakeWeightInstrumentRunner.java

/**
 * Puts together the GUI main panel component.
 * // ww w  . j a va  2 s  . c  om
 * @return
 */
protected JPanel buildMainPanel() {

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    panel.add(buildMeasureCountSubPanel());
    panel.add(buildResultsSubPanel());
    panel.add(buildActionButtonSubPanel());

    return panel;
}