Example usage for javax.swing BoxLayout Y_AXIS

List of usage examples for javax.swing BoxLayout Y_AXIS

Introduction

In this page you can find the example usage for javax.swing BoxLayout Y_AXIS.

Prototype

int Y_AXIS

To view the source code for javax.swing BoxLayout Y_AXIS.

Click Source Link

Document

Specifies that components should be laid out top to bottom.

Usage

From source file:edu.ucla.stat.SOCR.chart.demo.DotChart.java

public void doChart() {

    //System.out.println("dochart get called");

    if (dataTable.isEditing())
        dataTable.getCellEditor().stopCellEditing();
    if (!hasExample) {
        showMessageDialog(DATA_MISSING_MESSAGE);
        resetChart();/*from   w  w  w .  jav a  2s  .  c  o m*/
        return;
    }

    isDemo = false;
    XYDataset dataset1 = createDataset1(isDemo);
    JFreeChart chart1 = createChart1(dataset1);
    BoxAndWhiskerCategoryDataset dataset2 = createDataset2(isDemo);
    JFreeChart chart2 = createChart2(dataset2);

    graphPanel.removeAll();
    graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS));

    chartPanel1 = new ChartPanel(chart1, false);
    chartPanel1.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y / 2));

    chartPanel2 = new ChartPanel(chart2, false);
    chartPanel2.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y / 3));

    graphPanel.add(chartPanel1);
    graphPanel.add(chartPanel2);
    graphPanel.validate();

    // get the GRAPH panel to the front
    if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) != ALL) {
        tabbedPanelContainer.setSelectedIndex(tabbedPanelContainer.indexOfComponent(graphPanel));
        graphPanel.removeAll();
        graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS));

        graphPanel.add(chartPanel1);
        graphPanel.add(chartPanel2);
        graphPanel.validate();
    } else {
        graphPanel2.removeAll();
        chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3));
        graphPanel2.add(chartPanel1);
        graphPanel2.add(chartPanel2);
        graphPanel2.validate();
        summaryPanel.validate();
    }
}

From source file:net.sf.firemox.DeckBuilder.java

/**
 * Creates new form DeckBuilder//from  ww w.  ja  v a 2  s  . c om
 */
private DeckBuilder() {
    super("DeckBuilder");
    form = this;
    timerPanel = new TimerGlassPane();
    cardLoader = new CardLoader(timerPanel);
    timer = new Timer(200, cardLoader);
    setGlassPane(timerPanel);
    try {
        setIconImage(Picture.loadImage(IdConst.IMAGES_DIR + "deckbuilder.gif"));
    } catch (Exception e) {
        // IGNORING
    }

    // Load settings
    loadSettings();

    // Initialize components
    final JMenuItem newItem = UIHelper.buildMenu("menu_db_new", 'n', this);
    newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK));

    final JMenuItem loadItem = UIHelper.buildMenu("menu_db_load", 'o', this);
    loadItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK));

    final JMenuItem saveAsItem = UIHelper.buildMenu("menu_db_saveas", 'a', this);
    saveAsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0));

    final JMenuItem saveItem = UIHelper.buildMenu("menu_db_save", 's', this);
    saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));

    final JMenuItem quitItem = UIHelper.buildMenu("menu_db_exit", this);
    quitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK));

    final JMenuItem deckConstraintsItem = UIHelper.buildMenu("menu_db_constraints", 'c', this);
    deckConstraintsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0));

    final JMenuItem aboutItem = UIHelper.buildMenu("menu_help_about", 'a', this);
    aboutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, InputEvent.SHIFT_MASK));

    final JMenuItem convertDCK = UIHelper.buildMenu("menu_convert_DCK_MP", this);

    final JMenu mainMenu = UIHelper.buildMenu("menu_file");
    mainMenu.add(newItem);
    mainMenu.add(loadItem);
    mainMenu.add(saveAsItem);
    mainMenu.add(saveItem);
    mainMenu.add(new JSeparator());
    mainMenu.add(quitItem);

    super.optionMenu = new JMenu("Options");

    final JMenu convertMenu = UIHelper.buildMenu("menu_convert");
    convertMenu.add(convertDCK);

    final JMenuItem helpItem = UIHelper.buildMenu("menu_help_help", 'h', this);
    helpItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));

    final JMenu helpMenu = new JMenu("?");
    helpMenu.add(helpItem);
    helpMenu.add(deckConstraintsItem);
    helpMenu.add(aboutItem);

    final JMenuBar menuBar = new JMenuBar();
    menuBar.add(mainMenu);
    initAbstractMenu();
    menuBar.add(optionMenu);
    menuBar.add(convertMenu);
    menuBar.add(helpMenu);
    setJMenuBar(menuBar);
    addWindowListener(this);

    // Build the panel containing amount of available cards
    final JLabel amountLeft = new JLabel("<html>0/?", SwingConstants.RIGHT);

    // Build the left list
    allListModel = new MListModel<MCardCompare>(amountLeft, false);
    leftList = new ThreadSafeJList(allListModel);
    leftList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    leftList.setLayoutOrientation(JList.VERTICAL);
    leftList.getSelectionModel().addListSelectionListener(this);
    leftList.addMouseListener(this);
    leftList.setVisibleRowCount(10);

    // Initialize the text field containing the amount to add
    addQtyTxt = new JTextField("1");

    // Build the "Add" button
    addButton = new JButton(LanguageManager.getString("db_add"));
    addButton.setMnemonic('a');
    addButton.setEnabled(false);

    // Build the panel containing : "Add" amount and "Add" button
    final Box addPanel = Box.createHorizontalBox();
    addPanel.add(addButton);
    addPanel.add(addQtyTxt);
    addPanel.setMaximumSize(new Dimension(32010, 26));

    // Build the panel containing the selected card name
    cardNameTxt = new JTextField();
    new HireListener(cardNameTxt, addButton, this, leftList);

    final JLabel searchLabel = new JLabel(LanguageManager.getString("db_search") + " : ");
    searchLabel.setLabelFor(cardNameTxt);

    // Build the panel containing search label and card name text field
    final Box searchPanel = Box.createHorizontalBox();
    searchPanel.add(searchLabel);
    searchPanel.add(cardNameTxt);
    searchPanel.setMaximumSize(new Dimension(32010, 26));

    listScrollerLeft = new JScrollPane(leftList);
    MToolKit.addOverlay(listScrollerLeft);

    // Build the left panel containing : list, available amount, "Add" panel
    final JPanel srcPanel = new JPanel(null);
    srcPanel.add(searchPanel);
    srcPanel.add(listScrollerLeft);
    srcPanel.add(amountLeft);
    srcPanel.add(addPanel);
    srcPanel.setMinimumSize(new Dimension(220, 200));
    srcPanel.setLayout(new BoxLayout(srcPanel, BoxLayout.Y_AXIS));

    // Initialize constraints
    constraintsChecker = new ConstraintsChecker();
    constraintsChecker.setBorder(new EtchedBorder());
    final JScrollPane constraintsCheckerScroll = new JScrollPane(constraintsChecker);
    MToolKit.addOverlay(constraintsCheckerScroll);

    // create a pane with the oracle text for the present card
    oracleText = new JLabel();
    oracleText.setPreferredSize(new Dimension(180, 200));
    oracleText.setVerticalAlignment(SwingConstants.TOP);

    final JScrollPane oracle = new JScrollPane(oracleText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    MToolKit.addOverlay(oracle);

    // build some Pie Charts and a panel to display it
    initSets();
    datasets = new ChartSets();
    final JTabbedPane tabbedPane = new JTabbedPane();
    for (ChartFilter filter : ChartFilter.values()) {
        final Dataset dataSet = filter.createDataSet(this);
        final JFreeChart chart = new JFreeChart(null, null,
                filter.createPlot(dataSet, painterMapper.get(filter)), false);
        datasets.addDataSet(filter, dataSet);
        ChartPanel pieChartPanel = new ChartPanel(chart, true);
        tabbedPane.add(pieChartPanel, filter.getTitle());
    }
    // add the Constraints scroll panel and Oracle text Pane to the tabbedPane
    tabbedPane.add(constraintsCheckerScroll, LanguageManager.getString("db_constraints"));
    tabbedPane.add(oracle, LanguageManager.getString("db_text"));
    tabbedPane.setSelectedComponent(oracle);

    // The toollBar for color filtering
    toolBar = new JToolBar();
    toolBar.setFloatable(false);
    final JButton clearButton = UIHelper.buildButton("clear");
    clearButton.addActionListener(this);
    toolBar.add(clearButton);
    final JToggleButton toggleColorlessButton = new JToggleButton(
            UIHelper.getTbsIcon("mana/colorless/small/" + MdbLoader.unknownSmlMana), true);
    toggleColorlessButton.setActionCommand("0");
    toggleColorlessButton.addActionListener(this);
    toolBar.add(toggleColorlessButton);
    for (int index = 1; index < IdCardColors.CARD_COLOR_NAMES.length; index++) {
        final JToggleButton toggleButton = new JToggleButton(
                UIHelper.getTbsIcon("mana/colored/small/" + MdbLoader.coloredSmlManas[index]), true);
        toggleButton.setActionCommand(String.valueOf(index));
        toggleButton.addActionListener(this);
        toolBar.add(toggleButton);
    }

    // sorted card type combobox creation
    final List<String> idCards = new ArrayList<String>(Arrays.asList(CardFactory.exportedIdCardNames));
    Collections.sort(idCards);
    final Object[] cardTypes = ArrayUtils.addAll(new String[] { LanguageManager.getString("db_types.any") },
            idCards.toArray());
    idCardComboBox = new JComboBox(cardTypes);
    idCardComboBox.setSelectedIndex(0);
    idCardComboBox.addActionListener(this);
    idCardComboBox.setActionCommand("cardTypeFilter");

    // sorted card properties combobox creation
    final List<String> properties = new ArrayList<String>(
            CardFactory.getPropertiesName(DeckConstraints.getMinProperty(), DeckConstraints.getMaxProperty()));
    Collections.sort(properties);
    final Object[] cardProperties = ArrayUtils
            .addAll(new String[] { LanguageManager.getString("db_properties.any") }, properties.toArray());
    propertiesComboBox = new JComboBox(cardProperties);
    propertiesComboBox.setSelectedIndex(0);
    propertiesComboBox.addActionListener(this);
    propertiesComboBox.setActionCommand("propertyFilter");

    final JLabel colors = new JLabel(" " + LanguageManager.getString("colors") + " : ");
    final JLabel types = new JLabel(" " + LanguageManager.getString("types") + " : ");
    final JLabel property = new JLabel(" " + LanguageManager.getString("properties") + " : ");

    // filter Panel with colors toolBar and card type combobox
    final Box filterPanel = Box.createHorizontalBox();
    filterPanel.add(colors);
    filterPanel.add(toolBar);
    filterPanel.add(types);
    filterPanel.add(idCardComboBox);
    filterPanel.add(property);
    filterPanel.add(propertiesComboBox);

    getContentPane().add(filterPanel, BorderLayout.NORTH);

    // Destination section :

    // Build the panel containing amount of available cards
    final JLabel rightAmount = new JLabel("0/?", SwingConstants.RIGHT);
    rightAmount.setMaximumSize(new Dimension(220, 26));

    // Build the right list
    rightListModel = new MCardTableModel(new MListModel<MCardCompare>(rightAmount, true));
    rightListModel.addTableModelListener(this);
    rightList = new JTable(rightListModel);
    rightList.setShowGrid(false);
    rightList.setTableHeader(null);
    rightList.getSelectionModel().addListSelectionListener(this);
    rightList.getColumnModel().getColumn(0).setMaxWidth(25);
    rightList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);

    // Build the panel containing the selected deck
    deckNameTxt = new JTextField("loading...");
    deckNameTxt.setEditable(false);
    deckNameTxt.setBorder(null);
    final JLabel deckLabel = new JLabel(LanguageManager.getString("db_deck") + " : ");
    deckLabel.setLabelFor(deckNameTxt);
    final Box deckNamePanel = Box.createHorizontalBox();
    deckNamePanel.add(deckLabel);
    deckNamePanel.add(deckNameTxt);
    deckNamePanel.setMaximumSize(new Dimension(220, 26));

    // Initialize the text field containing the amount to remove
    removeQtyTxt = new JTextField("1");

    // Build the "Remove" button
    removeButton = new JButton(LanguageManager.getString("db_remove"));
    removeButton.setMnemonic('r');
    removeButton.addMouseListener(this);
    removeButton.setEnabled(false);

    // Build the panel containing : "Remove" amount and "Remove" button
    final Box removePanel = Box.createHorizontalBox();
    removePanel.add(removeButton);
    removePanel.add(removeQtyTxt);
    removePanel.setMaximumSize(new Dimension(220, 26));

    // Build the right panel containing : list, available amount, constraints
    final JScrollPane deskListScroller = new JScrollPane(rightList);
    MToolKit.addOverlay(deskListScroller);
    deskListScroller.setBorder(BorderFactory.createLineBorder(Color.GRAY));
    deskListScroller.setMinimumSize(new Dimension(220, 200));
    deskListScroller.setMaximumSize(new Dimension(220, 32000));

    final Box destPanel = Box.createVerticalBox();
    destPanel.add(deckNamePanel);
    destPanel.add(deskListScroller);
    destPanel.add(rightAmount);
    destPanel.add(removePanel);
    destPanel.setMinimumSize(new Dimension(220, 200));
    destPanel.setMaximumSize(new Dimension(220, 32000));

    // Build the panel containing the name of card in picture
    cardPictureNameTxt = new JLabel("<html><i>no selected card</i>");
    final Box cardPictureNamePanel = Box.createHorizontalBox();
    cardPictureNamePanel.add(cardPictureNameTxt);
    cardPictureNamePanel.setMaximumSize(new Dimension(32010, 26));

    // Group the detail panels
    final JPanel viewCard = new JPanel(null);
    viewCard.add(cardPictureNamePanel);
    viewCard.add(CardView.getInstance());
    viewCard.add(tabbedPane);
    viewCard.setLayout(new BoxLayout(viewCard, BoxLayout.Y_AXIS));

    final Box mainPanel = Box.createHorizontalBox();
    mainPanel.add(destPanel);
    mainPanel.add(viewCard);

    // Add the main panel
    getContentPane().add(srcPanel, BorderLayout.WEST);
    getContentPane().add(mainPanel, BorderLayout.CENTER);

    // Size this frame
    getRootPane().setPreferredSize(new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT));
    getRootPane().setMinimumSize(getRootPane().getPreferredSize());
    pack();
}

From source file:lol.search.RankedStatsPage.java

private JPanel headerPanel() {
    //init spacers for header
    for (int i = 0; i < 10; i++) {
        JLabel label = new JLabel("--");
        label.setForeground(new Color(0, 0, 0, 0));
        spacers.add(label);//  ww  w  .j a  va2  s.c  o  m
    }
    //header -- to set this semi-transparent i had to remove setOpaque and replace with setBackground(...)
    JPanel headerPanel = new JPanel();
    headerPanel.setLayout(new BorderLayout());
    //headerPanel.setBorder(BorderFactory.createLineBorder(Color.WHITE));
    headerPanel.setBackground(backgroundColor);
    headerPanel.setPreferredSize(headerDimension);
    //back button
    JPanel buttonHolder = new JPanel();
    ImageIcon buttonImage = new ImageIcon("assets\\other\\button.png");
    ImageIcon buttonPressedImage = new ImageIcon("assets\\other\\buttonPressed.png");
    Image tempImage = buttonImage.getImage();
    Image newTempImg = tempImage.getScaledInstance(75, 35, Image.SCALE_SMOOTH);
    buttonImage = new ImageIcon(newTempImg);
    JButton backButton = new JButton("BACK");
    backButton.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 10)); //custom font
    backButton.setForeground(Color.WHITE); //text color
    backButton.setBackground(new Color(0, 0, 0, 0));
    backButton.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    backButton.setHorizontalTextPosition(AbstractButton.CENTER);
    backButton.setPreferredSize(new Dimension(75, 35));
    //pressed button
    Image tempImage2 = buttonPressedImage.getImage();
    Image newTempImg2 = tempImage2.getScaledInstance(75, 35, Image.SCALE_SMOOTH);
    buttonPressedImage = new ImageIcon(newTempImg2);
    backButton.setIcon(buttonImage);
    backButton.setRolloverIcon(buttonPressedImage);
    backButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) { //button pressed
            System.out.println("Going back...\n");
            masterFrame.getContentPane().removeAll();
            masterFrame.revalidate();
            masterFrame.repaint();
            MainPage MAIN_PAGE = new MainPage(masterFrame, summonerName);
        }
    });
    buttonHolder.add(backButton);
    buttonHolder.setOpaque(false);
    headerPanel.add(buttonHolder, BorderLayout.LINE_START);
    //centerpanel
    JPanel centerPanel = new JPanel();
    centerPanel.setLayout(new GridLayout(1, 2));
    centerPanel.setOpaque(false);
    //centerPanel.setBorder(BorderFactory.createLineBorder(Color.WHITE));
    //rightcenter
    JPanel rightCenter = new JPanel();
    rightCenter.setOpaque(false);
    rightCenter.setLayout(new GridLayout(2, 1));
    //top center panel
    JPanel topCenter = new JPanel();
    topCenter.setOpaque(false);
    topCenter.setLayout(new BoxLayout(topCenter, BoxLayout.X_AXIS));
    //profile icon
    JPanel proIconPanel = new JPanel();
    proIconPanel.setOpaque(false);
    proIconPanel.setLayout(new BoxLayout(proIconPanel, BoxLayout.Y_AXIS));
    JLabel profileIconLabel = new JLabel(this.profileIcon);
    //profileIconLabel.setBorder(BorderFactory.createLineBorder(Color.WHITE));
    profileIconLabel.setAlignmentX(Component.RIGHT_ALIGNMENT);
    proIconPanel.add(profileIconLabel);
    centerPanel.add(proIconPanel);
    //empty spacer
    topCenter.add(spacers.get(0));
    //summoner name
    JLabel summonerNameLabel = new JLabel(this.summonerName);
    summonerNameLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 15)); //custom font
    summonerNameLabel.setForeground(Color.WHITE); //text color
    summonerNameLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    topCenter.add(summonerNameLabel);
    //empty spacer
    topCenter.add(spacers.get(1));
    //tier
    JLabel tierLabel = new JLabel(this.tier);
    tierLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 13)); //custom font
    tierLabel.setForeground(new Color(219, 219, 219)); //text color
    tierLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    topCenter.add(tierLabel);
    //empty spacer
    topCenter.add(spacers.get(2));
    //division
    JLabel divisionLabel = new JLabel(this.division);
    divisionLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 13)); //custom font
    divisionLabel.setForeground(new Color(219, 219, 219)); //text color
    divisionLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    topCenter.add(divisionLabel);
    //bottom center panel
    JPanel bottomCenter = new JPanel();
    bottomCenter.setOpaque(false);
    bottomCenter.setLayout(new BoxLayout(bottomCenter, BoxLayout.X_AXIS));
    //empty spacer
    bottomCenter.add(spacers.get(3));
    //season
    JLabel winsLabel = new JLabel(this.season);
    winsLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 14)); //custom font
    winsLabel.setForeground(new Color(219, 219, 219)); //text color
    winsLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    bottomCenter.add(winsLabel);

    rightCenter.add(topCenter);
    rightCenter.add(bottomCenter);
    centerPanel.add(rightCenter);
    headerPanel.add(centerPanel, BorderLayout.CENTER);
    //empty panel to balance right side
    JPanel ee = new JPanel();
    ee.setOpaque(false);
    ee.setPreferredSize(new Dimension(260, 50));
    headerPanel.add(ee, BorderLayout.LINE_END);
    return headerPanel;
}

From source file:MyLink.java

public JPanel printableKSGenerate() {
    // create a simple graph for the demo
    graph = new SparseMultigraph<Integer, MyLink>();

    Integer[] v = createVertices(getTermNum());
    createEdges(v);//from w  ww.j  a  v  a 2  s . co m

    vv = new VisualizationViewer<Integer, MyLink>(new KKLayout<Integer, MyLink>(graph));
    vv.setPreferredSize(new Dimension(520, 520)); // 570, 640 | 565, 640 

    vv.getRenderContext().setVertexLabelTransformer(new UnicodeVertexStringer<Integer>(v));
    vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.magenta));
    vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.magenta));
    VertexIconShapeTransformer<Integer> vertexIconShapeFunction = new VertexIconShapeTransformer<Integer>(
            new EllipseVertexShapeTransformer<Integer>());
    DefaultVertexIconTransformer<Integer> vertexIconFunction = new DefaultVertexIconTransformer<Integer>();
    vv.getRenderContext().setVertexShapeTransformer(vertexIconShapeFunction);
    vv.getRenderContext().setVertexIconTransformer(vertexIconFunction);
    loadImages(v, vertexIconFunction.getIconMap());
    vertexIconShapeFunction.setIconMap(vertexIconFunction.getIconMap());
    vv.getRenderContext().setVertexFillPaintTransformer(new PickableVertexPaintTransformer<Integer>(
            vv.getPickedVertexState(), new Color(0, 102, 255), Color.red));
    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<MyLink>(vv.getPickedEdgeState(), Color.orange, Color.cyan));
    vv.setBackground(Color.white);

    final int maxSize = findMaxSizeNumber();

    File file = new File("./output/DESC_TERM_COUNT.txt");
    String s;

    try {
        BufferedReader fis = new BufferedReader(new InputStreamReader(new FileInputStream(file)));

        s = fis.readLine();
        userSelectedTermsCount = Integer.parseInt(s);
        termIndex = new int[userSelectedTermsCount];

        int i = 0;
        while ((s = fis.readLine()) != null) {
            String[] tmp = s.split("=");
            termIndex[i] = Integer.parseInt(tmp[1].trim());
            i++;
        }

    } catch (IOException e) {
        System.out.println(e.getMessage());
    }

    Transformer<Integer, Shape> vertexSize = new Transformer<Integer, Shape>() {
        public Shape transform(Integer i) {
            double sizeInt = termIndex[i];
            sizeInt = (double) sizeInt / (double) maxSize;
            sizeInt = (double) sizeInt * (double) 30 + 10;
            Ellipse2D circle = new Ellipse2D.Double(sizeInt / 2 * (-1), sizeInt / 2 * (-1), sizeInt, sizeInt);
            return circle;
        }
    };
    vv.getRenderContext().setVertexShapeTransformer(vertexSize);
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.N);

    // add my listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller<Integer>());

    // create a frome to hold the graph
    APanel = new JPanel();
    APanel.setLayout(new BoxLayout(APanel, BoxLayout.Y_AXIS));

    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);

    final ModalGraphMouse gm = new DefaultModalGraphMouse<Integer, Number>();
    vv.setGraphMouse(gm);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JCheckBox lo = new JCheckBox("Show Labels");
    lo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            showLabels = e.getStateChange() == ItemEvent.SELECTED;

            vv.repaint();
        }
    });
    lo.setSelected(true);

    JPanel controls = new JPanel();
    controls.add(plus);
    controls.add(minus);
    controls.add(lo);
    controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox());
    APanel.add(vv);
    APanel.add(controls);

    return APanel;
}

From source file:au.org.ala.delta.intkey.ui.DefineButtonDialog.java

public DefineButtonDialog(Frame owner, boolean modal) {
    super(owner, modal);
    setPreferredSize(new Dimension(500, 430));

    ResourceMap resourceMap = Application.getInstance().getContext().getResourceMap(DefineButtonDialog.class);
    resourceMap.injectFields(this);
    ActionMap actionMap = Application.getInstance().getContext().getActionMap(DefineButtonDialog.class, this);

    setTitle(title);//from w w w.java  2 s . com

    _okButtonPressed = false;

    _pnlButtons = new JPanel();
    getContentPane().add(_pnlButtons, BorderLayout.SOUTH);

    _btnOk = new JButton();
    _btnOk.setAction(actionMap.get("DefineButtonDialog_OK"));
    _pnlButtons.add(_btnOk);

    _btnCancel = new JButton();
    _btnCancel.setAction(actionMap.get("DefineButtonDialog_Cancel"));
    _pnlButtons.add(_btnCancel);

    _btnHelp = new JButton();
    _btnHelp.setAction(actionMap.get("DefineButtonDialog_Help"));
    _btnHelp.setEnabled(false);
    _pnlButtons.add(_btnHelp);

    _pnlMain = new JPanel();
    getContentPane().add(_pnlMain, BorderLayout.CENTER);
    _pnlMain.setLayout(new BorderLayout(5, 0));

    _pnlButtonProperties = new JPanel();
    _pnlButtonProperties.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new CompoundBorder(
            new EtchedBorder(EtchedBorder.LOWERED, null, null), new EmptyBorder(5, 5, 5, 5))));
    _pnlMain.add(_pnlButtonProperties, BorderLayout.NORTH);
    GridBagLayout gbl__pnlButtonProperties = new GridBagLayout();
    gbl__pnlButtonProperties.columnWidths = new int[] { 475, 0 };
    gbl__pnlButtonProperties.rowHeights = new int[] { 14, 23, 14, 20, 14, 20, 14, 0, 23, 23, 23, 23, 0 };
    gbl__pnlButtonProperties.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl__pnlButtonProperties.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, Double.MIN_VALUE };
    _pnlButtonProperties.setLayout(gbl__pnlButtonProperties);

    _lblEnterNameOf = new JLabel(enterFileNameCaption);
    _lblEnterNameOf.setHorizontalAlignment(SwingConstants.LEFT);
    GridBagConstraints gbc__lblEnterNameOf = new GridBagConstraints();
    gbc__lblEnterNameOf.anchor = GridBagConstraints.WEST;
    gbc__lblEnterNameOf.insets = new Insets(0, 0, 5, 0);
    gbc__lblEnterNameOf.gridx = 0;
    gbc__lblEnterNameOf.gridy = 0;
    _pnlButtonProperties.add(_lblEnterNameOf, gbc__lblEnterNameOf);

    _pnlFile = new JPanel();
    GridBagConstraints gbc__pnlFile = new GridBagConstraints();
    gbc__pnlFile.fill = GridBagConstraints.HORIZONTAL;
    gbc__pnlFile.insets = new Insets(0, 0, 5, 0);
    gbc__pnlFile.gridx = 0;
    gbc__pnlFile.gridy = 1;
    _pnlButtonProperties.add(_pnlFile, gbc__pnlFile);
    _pnlFile.setLayout(new BorderLayout(0, 0));

    _txtFldFileName = new JTextField();
    _pnlFile.add(_txtFldFileName, BorderLayout.CENTER);
    _txtFldFileName.setColumns(10);

    _btnBrowse = new JButton();
    _btnBrowse.setAction(actionMap.get("DefineButtonDialog_Browse"));
    _pnlFile.add(_btnBrowse, BorderLayout.EAST);

    _lblEnterTheCommands = new JLabel(enterCommandsCaption);
    _lblEnterTheCommands.setHorizontalAlignment(SwingConstants.LEFT);
    GridBagConstraints gbc__lblEnterTheCommands = new GridBagConstraints();
    gbc__lblEnterTheCommands.anchor = GridBagConstraints.WEST;
    gbc__lblEnterTheCommands.insets = new Insets(0, 0, 5, 0);
    gbc__lblEnterTheCommands.gridx = 0;
    gbc__lblEnterTheCommands.gridy = 2;
    _pnlButtonProperties.add(_lblEnterTheCommands, gbc__lblEnterTheCommands);

    _txtFldCommands = new JTextField();
    GridBagConstraints gbc__txtFldCommands = new GridBagConstraints();
    gbc__txtFldCommands.fill = GridBagConstraints.HORIZONTAL;
    gbc__txtFldCommands.insets = new Insets(0, 0, 5, 0);
    gbc__txtFldCommands.gridx = 0;
    gbc__txtFldCommands.gridy = 3;
    _pnlButtonProperties.add(_txtFldCommands, gbc__txtFldCommands);
    _txtFldCommands.setColumns(10);

    _lblEnterBriefHelp = new JLabel(enterBriefHelpCaption);
    _lblEnterBriefHelp.setAlignmentY(Component.TOP_ALIGNMENT);
    GridBagConstraints gbc__lblEnterBriefHelp = new GridBagConstraints();
    gbc__lblEnterBriefHelp.anchor = GridBagConstraints.NORTHWEST;
    gbc__lblEnterBriefHelp.insets = new Insets(0, 0, 5, 0);
    gbc__lblEnterBriefHelp.gridx = 0;
    gbc__lblEnterBriefHelp.gridy = 4;
    _pnlButtonProperties.add(_lblEnterBriefHelp, gbc__lblEnterBriefHelp);

    _txtFldBriefHelp = new JTextField();
    GridBagConstraints gbc__txtFldBriefHelp = new GridBagConstraints();
    gbc__txtFldBriefHelp.fill = GridBagConstraints.HORIZONTAL;
    gbc__txtFldBriefHelp.insets = new Insets(0, 0, 5, 0);
    gbc__txtFldBriefHelp.gridx = 0;
    gbc__txtFldBriefHelp.gridy = 5;
    _pnlButtonProperties.add(_txtFldBriefHelp, gbc__txtFldBriefHelp);
    _txtFldBriefHelp.setColumns(10);

    _lblEnterMoreDetailed = new JLabel(enterDetailedHelpCaption);
    GridBagConstraints gbc__lblEnterMoreDetailed = new GridBagConstraints();
    gbc__lblEnterMoreDetailed.anchor = GridBagConstraints.WEST;
    gbc__lblEnterMoreDetailed.insets = new Insets(0, 0, 5, 0);
    gbc__lblEnterMoreDetailed.gridx = 0;
    gbc__lblEnterMoreDetailed.gridy = 6;
    _pnlButtonProperties.add(_lblEnterMoreDetailed, gbc__lblEnterMoreDetailed);

    _txtFldDetailedHelp = new JTextField();
    GridBagConstraints gbc__txtFldDetailedHelp = new GridBagConstraints();
    gbc__txtFldDetailedHelp.insets = new Insets(0, 0, 5, 0);
    gbc__txtFldDetailedHelp.fill = GridBagConstraints.HORIZONTAL;
    gbc__txtFldDetailedHelp.gridx = 0;
    gbc__txtFldDetailedHelp.gridy = 7;
    _pnlButtonProperties.add(_txtFldDetailedHelp, gbc__txtFldDetailedHelp);
    _txtFldDetailedHelp.setColumns(10);

    _chckbxEnableOnlyIfUsedCharacters = new JCheckBox(enableOnlyIfUsedCaption);
    GridBagConstraints gbc__chckbxEnableOnlyIf = new GridBagConstraints();
    gbc__chckbxEnableOnlyIf.anchor = GridBagConstraints.WEST;
    gbc__chckbxEnableOnlyIf.insets = new Insets(0, 0, 5, 0);
    gbc__chckbxEnableOnlyIf.gridx = 0;
    gbc__chckbxEnableOnlyIf.gridy = 8;
    _pnlButtonProperties.add(_chckbxEnableOnlyIfUsedCharacters, gbc__chckbxEnableOnlyIf);

    _rdbtnEnableInAll = new JRadioButton(enableInAllModesCaption);
    GridBagConstraints gbc__rdbtnEnableInAll = new GridBagConstraints();
    gbc__rdbtnEnableInAll.anchor = GridBagConstraints.WEST;
    gbc__rdbtnEnableInAll.insets = new Insets(0, 0, 5, 0);
    gbc__rdbtnEnableInAll.gridx = 0;
    gbc__rdbtnEnableInAll.gridy = 9;
    _pnlButtonProperties.add(_rdbtnEnableInAll, gbc__rdbtnEnableInAll);

    _rdbtnEnableInNormal = new JRadioButton(enableInNormalModeCaption);
    GridBagConstraints gbc__rdbtnEnableInNormal = new GridBagConstraints();
    gbc__rdbtnEnableInNormal.anchor = GridBagConstraints.WEST;
    gbc__rdbtnEnableInNormal.insets = new Insets(0, 0, 5, 0);
    gbc__rdbtnEnableInNormal.gridx = 0;
    gbc__rdbtnEnableInNormal.gridy = 10;
    _pnlButtonProperties.add(_rdbtnEnableInNormal, gbc__rdbtnEnableInNormal);

    _rdbtnEnableInAdvanced = new JRadioButton(enableInAdvancedModeCaption);
    GridBagConstraints gbc__rdbtnEnableInAdvanced = new GridBagConstraints();
    gbc__rdbtnEnableInAdvanced.anchor = GridBagConstraints.WEST;
    gbc__rdbtnEnableInAdvanced.gridx = 0;
    gbc__rdbtnEnableInAdvanced.gridy = 11;
    _pnlButtonProperties.add(_rdbtnEnableInAdvanced, gbc__rdbtnEnableInAdvanced);

    _pnlSpaceRemoveAll = new JPanel();
    _pnlSpaceRemoveAll.setBorder(new EmptyBorder(0, 10, 0, 0));
    _pnlMain.add(_pnlSpaceRemoveAll, BorderLayout.SOUTH);
    _pnlSpaceRemoveAll.setLayout(new BoxLayout(_pnlSpaceRemoveAll, BoxLayout.Y_AXIS));

    _chckbxInsertASpace = new JCheckBox(insertSpaceCaption);
    _chckbxInsertASpace.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            _insertSpace = !_insertSpace;

            if (_insertSpace) {
                _removeAllButtons = false;
                _chckbxRemoveAllButtons.setSelected(false);
            }

            updateButtonPropertyControls();
        }
    });
    _pnlSpaceRemoveAll.add(_chckbxInsertASpace);

    _chckbxRemoveAllButtons = new JCheckBox(removeAllCaption);
    _chckbxRemoveAllButtons.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            _removeAllButtons = !_removeAllButtons;

            if (_removeAllButtons) {
                _insertSpace = false;
                _chckbxInsertASpace.setSelected(false);
            }

            updateButtonPropertyControls();
        }
    });
    _pnlSpaceRemoveAll.add(_chckbxRemoveAllButtons);

    _pnlButtonProperties.setEnabled(false);

    ButtonGroup btnGroup = new ButtonGroup();
    btnGroup.add(_rdbtnEnableInAll);
    btnGroup.add(_rdbtnEnableInNormal);
    btnGroup.add(_rdbtnEnableInAdvanced);

    _rdbtnEnableInAll.setSelected(true);
}

From source file:GeometryByReferenceNIOBuffer.java

public void init() {
    Container contentPane = getContentPane();

    Canvas3D c = new Canvas3D(SimpleUniverse.getPreferredConfiguration());
    contentPane.add("Center", c);

    BranchGroup scene = createSceneGraph();
    // SimpleUniverse is a Convenience Utility class
    u = new SimpleUniverse(c);

    // add mouse behaviors to the viewingPlatform
    ViewingPlatform viewingPlatform = u.getViewingPlatform();

    // This will move the ViewPlatform back a bit so the
    // objects in the scene can be viewed.
    viewingPlatform.setNominalViewingTransform();
    u.addBranchGraph(scene);//  ww  w . j av  a2  s . co m

    // add Orbit behavior to the ViewingPlatform
    OrbitBehavior orbit = new OrbitBehavior(c, OrbitBehavior.REVERSE_ALL);
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);
    orbit.setSchedulingBounds(bounds);
    viewingPlatform.setViewPlatformBehavior(orbit);

    // Create GUI
    JPanel p = new JPanel();
    BoxLayout boxlayout = new BoxLayout(p, BoxLayout.Y_AXIS);
    p.add(createGeometryByReferencePanel());
    p.add(createUpdatePanel());
    p.setLayout(boxlayout);

    contentPane.add("South", p);
}

From source file:medsavant.uhn.cancer.UserCommentApp.java

private JPanel getCommentBlock(UserCommentGroup lcg, UserComment lc/*, UserComment oldComment*/) {

    JPanel innerPanel = new JPanel();
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));

    JPanel headerPanel = getHeaderPanel(lc);
    JPanel commentPanel = getCommentPanel(lc);

    if (lc.getOriginalComment() == null) { //root level comment.
        innerPanel.add(headerPanel);//from  w  w  w .  j  ava  2 s  . com
        innerPanel.add(getStatusIconPanel(lcg, lc));
        innerPanel.add(commentPanel);
        innerPanel.add(getCommentSeparator());

        return innerPanel;
    } else { //status comment.
        JPanel outerPanel = new JPanel();
        outerPanel.setLayout(new BoxLayout(outerPanel, BoxLayout.X_AXIS));
        JSeparator js = new JSeparator();
        js.setPreferredSize(new Dimension(STATUS_COMMENT_INDENT_WIDTH, 1));
        outerPanel.add(js);

        innerPanel.add(headerPanel);

        //System.out.println("Constructing statusIconPanel with "+lc.isApproved()+","+lc.isIncluded()+","+lc.isPendingReview());
        JPanel statusIconPanel = new StatusIconPanel(ICON_WIDTH, ICON_HEIGHT, false, lc.isApproved(),
                lc.isIncluded(), lc.isDeleted());

        JPanel centeredLabel = new JPanel();
        centeredLabel.setLayout(new BoxLayout(centeredLabel, BoxLayout.X_AXIS));
        centeredLabel.add(Box.createHorizontalGlue());
        centeredLabel.add(new JLabel("Status Change:"));
        centeredLabel.add(Box.createHorizontalGlue());
        innerPanel.add(centeredLabel);
        oldStatusPanel = new JPanel();
        oldStatusPanel.setLayout(new BoxLayout(oldStatusPanel, BoxLayout.X_AXIS));
        oldStatusPanel.add(Box.createHorizontalGlue());
        oldStatusPanel.add(statusIconPanel);
        innerPanel.add(oldStatusPanel);
        innerPanel.add(commentPanel);
        innerPanel.add(getCommentSeparator());
        outerPanel.add(innerPanel);
        return outerPanel;
    }
}

From source file:cloud.gui.CloudGUI.java

private JPanel createCurrentInstancesPanel() {
    JPanel currentInstancesPanel = new JPanel();
    currentInstancesPanel.setBorder(BorderFactory.createTitledBorder("Current Instances"));
    currentInstancesPanel.setLayout(new BoxLayout(currentInstancesPanel, BoxLayout.Y_AXIS));
    Box layout = Box.createVerticalBox();

    createNumberOfInstancesStatus(layout);
    createTotalCost(layout);/* w w  w  .  j av  a 2  s  . co m*/
    createInstanceTable(layout);

    removeInstanceButton = new JButton("Remove instance");

    layout.add(removeInstanceButton);
    currentInstancesPanel.add(layout);
    return currentInstancesPanel;
}

From source file:com.apatar.ui.JPublishToApatarDialog.java

private void createDialog() {

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    this.setLayout(gridbag);

    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1.0;//from  w  ww. jav  a2s .  c  o  m
    c.weighty = 0.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    //c.insets = new Insets(5, 5, 5, 5);

    JPanel panelLogin = new JPanel();
    panelLogin.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelLogin.setLayout(new BoxLayout(panelLogin, BoxLayout.X_AXIS));
    panelLogin.add(new JLabel("User Name"));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(username);
    username.setComponentPopupMenu(new JDefaultContextMenu(username));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(new JLabel("Password"));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(password);

    JPanel panelForgotPassLink = new JPanel();
    panelForgotPassLink.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelForgotPassLink.setLayout(new BoxLayout(panelForgotPassLink, BoxLayout.X_AXIS));
    panelForgotPassLink.add(new JLabel("Lost your password? "));
    panelForgotPassLink.add(Box.createHorizontalStrut(5));
    panelForgotPassLink.add(forgotPassLinkLabel);

    forgotPassLinkLabel.setFont(UiUtils.NORMAL_SIZE_12_FONT);
    forgotPassLinkLabel.addMouseListener(new MouseHyperLinkEvent());
    forgotPassLinkLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    forgotPassLinkLabel.setText(
            "<html><a href='http://www.apatarforge.org/profile/lostpassword.html'>Click here to retrieve it</a></html>");

    JPanel panelFile = new JPanel();
    panelFile.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelFile.setLayout(new BoxLayout(panelFile, BoxLayout.X_AXIS));
    panelFile.add(selectFromFile);
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(new JLabel("New File "));
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(nameFile);
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(browse);
    nameFile.setEnabled(false);
    nameFile.setComponentPopupMenu(new JDefaultContextMenu(nameFile));
    browse.setEnabled(false);

    JPanel panelLocation = new JPanel();
    panelLocation.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelLocation.setLayout(new BoxLayout(panelLocation, BoxLayout.X_AXIS));
    panelLocation.add(new JLabel("Suggest Location:"));
    panelLocation.add(Box.createHorizontalStrut(5));
    panelLocation.add(location);

    JPanel panelDMName = new JPanel();
    panelDMName.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMName.setLayout(new BoxLayout(panelDMName, BoxLayout.X_AXIS));
    JLabel datamapNameLabel = new JLabel("DataMap Name:");
    datamapNameLabel.setBorder(new EmptyBorder(0, 0, 0, 10));
    panelDMName.add(datamapNameLabel);
    panelDMName.add(Box.createHorizontalStrut(5));
    panelDMName.add(dataMapName);
    dataMapName.setComponentPopupMenu(new JDefaultContextMenu(dataMapName));

    JPanel panelDMDescription = new JPanel();
    panelDMDescription.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMDescription.setLayout(new BoxLayout(panelDMDescription, BoxLayout.X_AXIS));
    panelDMDescription.add(new JLabel("DataMap Description (16000 Chars)"));
    panelDMDescription.add(Box.createHorizontalStrut(5));
    //JScrollPane scroll = new JScrollPane(dataMapDescription);
    //scroll.setSize(300, 50);
    dataMapDescription.setLineWrap(true);
    dataMapDescription.setWrapStyleWord(true);
    panelDMDescription.add(new JScrollPane(dataMapDescription));

    JPanel panelDMShortDescription = new JPanel();
    panelDMShortDescription.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMShortDescription.setLayout(new BoxLayout(panelDMShortDescription, BoxLayout.X_AXIS));
    JLabel labelShort = new JLabel("Short Description:");
    labelShort.setBorder(new EmptyBorder(0, 0, 0, 85));
    panelDMShortDescription.add(labelShort);
    panelDMShortDescription.add(Box.createHorizontalStrut(5));
    shortDescription.setLineWrap(true);
    shortDescription.setWrapStyleWord(true);
    panelDMShortDescription.add(new JScrollPane(shortDescription));
    setEnableShortDescription(false);

    // -------------

    JPanel panelTitleForTags = new JPanel();
    panelTitleForTags.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelTitleForTags.setLayout(new BoxLayout(panelTitleForTags, BoxLayout.X_AXIS));
    panelTitleForTags.add(new JLabel("Add tags associated with your DataMap:"));

    // -------------

    JPanel panelListAddedTags = new JPanel();
    panelListAddedTags.setBorder(new EmptyBorder(0, 10, 10, 10));
    panelListAddedTags.setLayout(new BoxLayout(panelListAddedTags, BoxLayout.X_AXIS));

    // --
    JPanel panelFrom = new JPanel();
    panelFrom.setLayout(new BoxLayout(panelFrom, BoxLayout.Y_AXIS));
    JPanel panelMiddle = new JPanel();
    panelMiddle.setLayout(new BoxLayout(panelMiddle, BoxLayout.X_AXIS));
    JPanel panelTo = new JPanel();
    panelTo.setLayout(new BoxLayout(panelTo, BoxLayout.Y_AXIS));

    // --
    JPanel panelAddNewTag = new JPanel();
    panelAddNewTag.setLayout(new BoxLayout(panelAddNewTag, BoxLayout.X_AXIS));
    panelAddNewTag.add(new JLabel("Add new tag:"));
    panelAddNewTag.add(Box.createHorizontalStrut(5));
    textfieldAddNewTag = new JTextField();
    textfieldAddNewTag.setComponentPopupMenu(new JDefaultContextMenu(textfieldAddNewTag));
    panelAddNewTag.add(textfieldAddNewTag);
    panelAddNewTag.add(Box.createHorizontalStrut(5));
    JButton buttonAddTag = new JButton("Add");
    buttonAddTag.addActionListener(addNewTagMouseListener);
    panelAddNewTag.add(buttonAddTag);

    // --
    JPanel panelDeleteTags = new JPanel();
    panelDeleteTags.setLayout(new BoxLayout(panelDeleteTags, BoxLayout.X_AXIS));

    panelDeleteTags.add(new JLabel("Delete selected tag(s):"));
    panelDeleteTags.add(Box.createHorizontalStrut(5));
    JButton buttonDeleteTag = new JButton("Delete");
    buttonDeleteTag.addActionListener(deleteTagMouseListener);
    panelDeleteTags.add(buttonDeleteTag);
    panelDeleteTags.add(new JPanel());

    // --

    JButton moveTag = new JButton(UiUtils.ARROW_ICON);
    moveTag.addActionListener(addTagsMouseListener);
    panelMiddle.add(moveTag);

    tblModelFrom = new DefaultTableModel();
    tblModelTo = new DefaultTableModel();
    tblModelFrom.addColumn("Tag Name");
    tblModelTo.addColumn("Tag Name");

    tagsTableFrom = new JTable(tblModelFrom);
    tagsTableTo = new JTable(tblModelTo);

    tagsTableFrom.setOpaque(false);
    tagsTableFrom.setBackground(null);
    tagsTableFrom.setBorder(null);
    tagsTableFrom.setShowGrid(false);

    tagsTableTo.setOpaque(false);
    tagsTableTo.setBackground(null);
    tagsTableTo.setBorder(null);
    tagsTableTo.setShowGrid(false);

    tagsTableFrom.getColumn("Tag Name").setCellEditor(new CellEditor(new JTextField()));
    tagsTableTo.getColumn("Tag Name").setCellEditor(new CellEditor(new JTextField()));

    fillTableTags();

    tagsTableFrom.setComponentPopupMenu(new JDefaultContextMenu(tagsTableFrom));
    tagsTableTo.setComponentPopupMenu(new JDefaultContextMenu(tagsTableTo));

    JScrollPane srollPane = new JScrollPane(tagsTableFrom);
    srollPane.setBorder(null);

    JScrollPane srollPane2 = new JScrollPane(tagsTableTo);
    srollPane.setBorder(null);

    panelFrom.add(srollPane);
    panelFrom.add(Box.createVerticalStrut(5));
    panelFrom.add(panelAddNewTag);

    panelTo.add(srollPane2);
    panelTo.add(Box.createVerticalStrut(5));
    panelTo.add(panelDeleteTags);

    panelListAddedTags.add(panelFrom);
    panelListAddedTags.add(Box.createHorizontalStrut(5));
    panelListAddedTags.add(panelMiddle);
    panelListAddedTags.add(Box.createHorizontalStrut(5));
    panelListAddedTags.add(panelTo);

    // -------

    JPanel panelButton = new JPanel();
    panelButton.setLayout(new BoxLayout(panelButton, BoxLayout.X_AXIS));
    panelButton.add(Box.createHorizontalGlue());
    panelButton.add(bOk);
    panelButton.add(Box.createHorizontalStrut(5));
    panelButton.add(bCancel);
    panelButton.add(Box.createHorizontalStrut(5));

    ComponentBuilder.makeComponent(new JCommentPanel(), gridbag, c, getContentPane());

    ComponentBuilder.makeComponent(panelLogin, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelForgotPassLink, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelFile, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelLocation, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelDMName, gridbag, c, getContentPane());

    c.fill = GridBagConstraints.BOTH;

    c.weighty = 2.0;
    ComponentBuilder.makeComponent(panelDMDescription, gridbag, c, getContentPane());

    c.weighty = 0.0;
    ComponentBuilder.makeComponent(autoGenerateShortDescription, gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelDMShortDescription, gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelTitleForTags, gridbag, c, getContentPane());

    c.weighty = 3.0;
    ComponentBuilder.makeComponent(panelListAddedTags, gridbag, c, getContentPane());

    c.weighty = 0.0;
    ComponentBuilder.makeComponent(new JSeparator(), gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelButton, gridbag, c, getContentPane());
}

From source file:com.clank.launcher.swing.SwingHelper.java

public static Component alignTabbedPane(Component component) {
    JPanel container = new JPanel();
    container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
    container.add(component);//from ww w . j a va  2 s  .co m
    container.add(new Box.Filler(new Dimension(0, 0), new Dimension(0, 10000), new Dimension(0, 10000)));
    SwingHelper.removeOpaqueness(container);
    return container;
}