Example usage for javax.swing BorderFactory createCompoundBorder

List of usage examples for javax.swing BorderFactory createCompoundBorder

Introduction

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

Prototype

public static CompoundBorder createCompoundBorder(Border outsideBorder, Border insideBorder) 

Source Link

Document

Creates a compound border specifying the border objects to use for the outside and inside edges.

Usage

From source file:com.jvms.i18neditor.editor.Editor.java

private void setupUI() {
    Color borderColor = Colors.scale(UIManager.getColor("Panel.background"), .8f);

    setTitle(TITLE);/*from  ww  w.  ja  v  a2s.  c o m*/
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(new EditorWindowListener());

    setIconImages(Lists.newArrayList("512", "256", "128", "64", "48", "32", "24", "20", "16").stream()
            .map(size -> Images.loadFromClasspath("images/icon-" + size + ".png").getImage())
            .collect(Collectors.toList()));

    translationTree = new TranslationTree();
    translationTree.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    translationTree.addTreeSelectionListener(new TranslationTreeNodeSelectionListener());
    translationTree.addMouseListener(new TranslationTreeMouseListener());

    translationField = new TranslationField();
    translationField.addKeyListener(new TranslationFieldKeyListener());
    translationField.setBorder(
            BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(1, 0, 0, 1, borderColor),
                    ((CompoundBorder) translationField.getBorder()).getInsideBorder()));

    JScrollPane translationsScrollPane = new JScrollPane(translationTree);
    translationsScrollPane.getViewport().setOpaque(false);
    translationsScrollPane.setOpaque(false);
    translationsScrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, borderColor));

    translationsPanel = new JPanel(new BorderLayout());
    translationsPanel.add(translationsScrollPane);
    translationsPanel.add(translationField, BorderLayout.SOUTH);

    resourcesPanel = new JScrollablePanel(true, false);
    resourcesPanel.setLayout(new BoxLayout(resourcesPanel, BoxLayout.Y_AXIS));
    resourcesPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 20));
    resourcesPanel.setOpaque(false);
    resourcesPanel.addMouseListener(new ResourcesPaneMouseListener());

    resourcesScrollPane = new JScrollPane(resourcesPanel);
    resourcesScrollPane.getViewport().setOpaque(false);
    resourcesScrollPane.setOpaque(false);
    resourcesScrollPane.setBorder(null);
    resourcesScrollPane.addMouseListener(new ResourcesPaneMouseListener());

    contentPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, translationsPanel, resourcesScrollPane);
    contentPane.setBorder(null);
    contentPane.setDividerSize(10);

    // Style the split pane divider if possible
    SplitPaneUI splitPaneUI = contentPane.getUI();
    if (splitPaneUI instanceof BasicSplitPaneUI) {
        BasicSplitPaneDivider divider = ((BasicSplitPaneUI) splitPaneUI).getDivider();
        divider.setBorder(null);
        resourcesPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 20));
    }

    introText = new JLabel("<html><body style=\"text-align:center; padding:30px;\">"
            + MessageBundle.get("core.intro.text") + "</body></html>");
    introText.setOpaque(true);
    introText.setFont(introText.getFont().deriveFont(28f));
    introText.setHorizontalTextPosition(JLabel.CENTER);
    introText.setVerticalTextPosition(JLabel.BOTTOM);
    introText.setHorizontalAlignment(JLabel.CENTER);
    introText.setVerticalAlignment(JLabel.CENTER);
    introText.setForeground(getBackground().darker());
    introText.setIcon(Images.loadFromClasspath("images/icon-intro.png"));

    Container container = getContentPane();
    container.add(introText);

    editorMenu = new EditorMenuBar(this, translationTree);
    setJMenuBar(editorMenu);
}

From source file:com.xilinx.kintex7.MainScreen.java

private JPanel testAndStats() {
    JPanel tstats = new JPanel();
    tstats.setLayout(new BoxLayout(tstats, BoxLayout.Y_AXIS));

    JPanel ledPanel = new JPanel(new BorderLayout());

    JPanel iledPanel = new JPanel();
    iledPanel.setLayout(new BoxLayout(iledPanel, BoxLayout.X_AXIS));

    led_ddr3 = new JLabel("DDR3", new ImageIcon(led1), JLabel.CENTER);
    led_phy0 = new JLabel("10G PHY-0", new ImageIcon(led1), JLabel.CENTER);
    led_phy1 = new JLabel("10G PHY-1", new ImageIcon(led1), JLabel.CENTER);

    JPanel le1 = new JPanel(new BorderLayout());
    le1.add(led_ddr3, BorderLayout.CENTER);

    JPanel le2 = new JPanel(new BorderLayout());
    le2.add(led_phy0, BorderLayout.CENTER);

    JPanel le3 = new JPanel(new BorderLayout());
    le3.add(led_phy1, BorderLayout.CENTER);

    iledPanel.add(le1);// w  w w  .j  a va 2s. co  m
    iledPanel.add(le2);
    iledPanel.add(le3);

    ledPanel.add(iledPanel, BorderLayout.CENTER);
    tstats.add(ledPanel);

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

    tstats1.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""),
            BorderFactory.createRaisedBevelBorder()));

    tstats1.add(testPanelItems());

    JPanel dmaInner = new JPanel(new BorderLayout());

    JPanel dmaPanel = new JPanel(new BorderLayout());

    dmaPanel.setBackground(new Color(130, 170, 180));
    table1 = new MyTableModel(dummy_data, dmaColumnNames0);
    dmaStats1 = new JTable(table1);
    try {
        dmaStats1.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
    } catch (Exception e) {
    }
    JTableHeader dmaHeader = dmaStats1.getTableHeader();
    dmaHeader.setForeground(new Color(92, 25, 25));

    dmaPanel.add(dmaHeader, BorderLayout.PAGE_START);
    dmaPanel.add(dmaStats1, BorderLayout.CENTER);
    dmaInner.add(dmaPanel, BorderLayout.CENTER);
    tstats1.add(dmaInner);
    tstats.add(tstats1);

    JPanel trnPanel = new JPanel(new GridLayout(1, 1));
    trnPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("PCIe Statistics"),
            BorderFactory.createRaisedBevelBorder()));
    JPanel trn1 = new JPanel(new FlowLayout());
    trn1.add(new JLabel("Transmit (writes in Gbps): "));
    trnLTX = new JTextField("0.0", 5);
    trnLTX.setEditable(false);
    trn1.add(trnLTX);
    trn1.add(new JLabel("Receive (reads in Gbps): "));
    trnLRX = new JTextField("0.0", 5);
    trnLRX.setEditable(false);
    trn1.add(trnLRX);
    trnPanel.add(trn1);
    tstats.add(trnPanel);

    JPanel tstats2 = new JPanel();
    tstats2.setLayout(new BoxLayout(tstats2, BoxLayout.Y_AXIS));
    tstats2.add(testPanelItems1());

    tstats2.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""),
            BorderFactory.createRaisedBevelBorder()));

    JPanel dmaPanel1 = new JPanel(new BorderLayout());

    table2 = new MyTableModel(dummy_data, dmaColumnNames1);
    dmaStats2 = new JTable(table2);
    try {
        dmaStats2.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
    } catch (Exception e) {
    }
    JTableHeader dmaHeader1 = dmaStats2.getTableHeader();
    dmaHeader1.setForeground(new Color(92, 25, 25));

    dmaPanel1.add(dmaHeader1, BorderLayout.PAGE_START);
    dmaPanel1.add(dmaStats2, BorderLayout.CENTER);
    tstats2.add(dmaPanel1);
    tstats.add(tstats2);

    JPanel tstats3 = new JPanel(new BorderLayout());
    tstats3.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Message Log"),
            BorderFactory.createRaisedBevelBorder()));
    textArea = new CustomTextPane();

    final JScrollPane scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    // keep scrollbar at end showing latest messages
    scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
        BoundedRangeModel brm = scrollPane.getVerticalScrollBar().getModel();
        boolean wasAtBottom = true;

        @Override
        public void adjustmentValueChanged(AdjustmentEvent ae) {
            if (!brm.getValueIsAdjusting()) {
                if (wasAtBottom)
                    brm.setValue(brm.getMaximum());
            } else
                wasAtBottom = ((brm.getValue() + brm.getExtent()) == brm.getMaximum());
        }
    });

    textArea.setEditable(false);
    tstats3.add(scrollPane, BorderLayout.CENTER);
    tstats.add(tstats3);
    return tstats;
}

From source file:com.hp.alm.ali.idea.content.taskboard.TaskBoardPanel.java

private JComponent columnHeader(String name) {
    BoldLabel label = new BoldLabel(name);
    label.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 1, 0, 0),
            BorderFactory.createEtchedBorder()));
    label.setPreferredSize(new Dimension(MIN_COLUMN_WIDTH, 26));
    return label;
}

From source file:net.rptools.maptool.launcher.MapToolLauncher.java

private JPanel buildTroubleshootingPanel() {
    final JPanel p = new JPanel();
    p.setLayout(new BorderLayout());

    ActionListener levelChange = new ActionListener() {
        @Override//ww  w. j av  a 2  s. c  om
        public void actionPerformed(ActionEvent e) {
            Level x = Level.parse(e.getActionCommand());
            if (Level.OFF.equals(x) || Level.INFO.equals(x) || Level.WARNING.equals(x)
                    || Level.SEVERE.equals(x))
                log.setLevel(x);
        }
    };
    JPanel logPanel = new JPanel();
    logPanel.setLayout(new GridLayout(0, 1));
    logPanel.setBorder(new TitledBorder(new LineBorder(Color.BLACK),
            CopiedFromOtherJars.getText("msg.logDetailPanel.border"))); //$NON-NLS-1$
    logPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    ButtonGroup logGroup = new ButtonGroup();
    for (Level type : new Level[] { Level.OFF, Level.INFO, Level.WARNING, Level.SEVERE }) {
        JRadioButton jrb = new JRadioButton(type.toString());
        jrb.setActionCommand(type.toString());
        jrb.addActionListener(levelChange);
        jrb.setBorder(
                BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.red), jrb.getBorder()));
        logPanel.add(jrb);
        logGroup.add(jrb);
        if (type == Level.WARNING) {
            jrb.setSelected(true);
            log.setLevel(type);
        }
    }
    jcbEnableAssertions.setAlignmentX(Component.LEFT_ALIGNMENT);
    jcbEnableAssertions.setText(CopiedFromOtherJars.getText("msg.info.enableAssertions")); //$NON-NLS-1$
    jcbEnableAssertions.setToolTipText(CopiedFromOtherJars.getText("msg.tooltip.enableAssertions")); //$NON-NLS-1$
    jcbEnableAssertions.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                if (!extraArgs.contains(ASSERTIONS_OPTION)) {
                    extraArgs = (ASSERTIONS_OPTION + " " + extraArgs); //$NON-NLS-1$
                }
            } else if (e.getStateChange() == ItemEvent.DESELECTED) {
                extraArgs = extraArgs.replace(ASSERTIONS_OPTION, ""); //$NON-NLS-1$
            }
            extraArgs = extraArgs.trim();
            jtfArgs.setText(extraArgs);
            updateCommand();
        }
    });
    p.add(logPanel, BorderLayout.NORTH);
    Box other = new Box(BoxLayout.PAGE_AXIS);
    other.add(jcbEnableAssertions);
    other.add(Box.createVerticalGlue());
    p.add(other, BorderLayout.CENTER);
    return p;
}

From source file:com.chart.SwingChart.java

/**
 * Background edition/*from  w  w w  .  jav  a  2 s.  c  o m*/
 */
final public void backgroundEdition() {
    final ColorPicker colorPickerChartBackground = new ColorPicker(
            javafx.scene.paint.Color.web(strChartBackgroundColor));
    colorPickerChartBackground.setMaxWidth(Double.MAX_VALUE);
    final ColorPicker colorPickerGridline = new ColorPicker(javafx.scene.paint.Color.web(strGridlineColor));
    colorPickerGridline.setMaxWidth(Double.MAX_VALUE);
    final ColorPicker colorPickerBackground = new ColorPicker(javafx.scene.paint.Color.web(strBackgroundColor));
    colorPickerBackground.setMaxWidth(Double.MAX_VALUE);
    final ColorPicker colorPickerTick = new ColorPicker(javafx.scene.paint.Color.web(strTickColor));
    colorPickerTick.setMaxWidth(Double.MAX_VALUE);
    final TextField tfFontSize = new TextField();
    tfFontSize.setMaxWidth(Double.MAX_VALUE);

    GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(0, 10, 0, 10));

    grid.add(new Label("Background color"), 0, 0);
    grid.add(colorPickerChartBackground, 1, 0);
    grid.add(new Label("Gridline color"), 0, 1);
    grid.add(colorPickerGridline, 1, 1);
    grid.add(new Label("Frame color"), 0, 2);
    grid.add(colorPickerBackground, 1, 2);
    grid.add(new Label("Tick color"), 0, 3);
    grid.add(colorPickerTick, 1, 3);
    grid.add(new Label("Font size"), 0, 4);
    grid.add(tfFontSize, 1, 4);
    tfFontSize.setText(String.valueOf(fontSize));

    new PseudoModalDialog(skeleton, grid, true) {

        @Override
        public boolean validation() {
            fontSize = Float.valueOf(tfFontSize.getText().replace(",", "."));
            strBackgroundColor = colorPickerBackground.getValue().toString().replace("0x", "#");
            for (Node le : legendFrame.getChildren()) {
                if (le instanceof LegendAxis) {
                    le.setStyle("-fx-background-color:" + strBackgroundColor);
                    ((LegendAxis) le).selected = false;
                }
            }
            chart.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)));
            chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
                    BorderFactory.createLineBorder(
                            scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)))));
            chartPanel.setBackground(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)));

            legendFrame.setStyle("marco: " + colorPickerBackground.getValue().toString().replace("0x", "#")
                    + ";-fx-background-color: marco;");

            strChartBackgroundColor = colorPickerChartBackground.getValue().toString().replace("0x", "#");
            plot.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strChartBackgroundColor)));

            for (Node le : legendFrame.getChildren()) {
                if (le instanceof LegendAxis) {
                    le.setStyle("-fx-background-color:" + strBackgroundColor);
                    ((LegendAxis) le).selected = false;
                    for (Node nn : ((LegendAxis) le).getChildren()) {
                        if (nn instanceof Label) {
                            ((Label) nn).setStyle("fondo: "
                                    + colorPickerChartBackground.getValue().toString().replace("0x", "#")
                                    + ";-fx-background-color: fondo;-fx-text-fill: ladder(fondo, white 49%, black 50%);-fx-padding:5px;-fx-background-radius: 5;-fx-font-size: "
                                    + String.valueOf(fontSize) + "px");
                        }
                    }
                }
            }

            strGridlineColor = colorPickerGridline.getValue().toString().replace("0x", "#");
            plot.setDomainGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor)));
            plot.setRangeGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor)));

            strTickColor = colorPickerTick.getValue().toString().replace("0x", "#");
            abcissaAxis.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
            abcissaAxis.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
            abcissaAxis.setLabelFont(abcissaAxis.getLabelFont().deriveFont(fontSize));
            abcissaAxis.setTickLabelFont(abcissaAxis.getLabelFont().deriveFont(fontSize));

            for (NumberAxis ejeOrdenada : AxesList) {
                ejeOrdenada.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
                ejeOrdenada.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
                ejeOrdenada.setLabelFont(ejeOrdenada.getLabelFont().deriveFont(fontSize));
                ejeOrdenada.setTickLabelFont(ejeOrdenada.getLabelFont().deriveFont(fontSize));
            }
            return true;
        }
    }.show();

}

From source file:com.xilinx.kintex7.MainScreen.java

private JPanel pciInfo() {
    JPanel pciSystemPanel = new JPanel();
    pciSystemPanel.setLayout(new BoxLayout(pciSystemPanel, BoxLayout.Y_AXIS));

    JPanel topPanel = new JPanel(new GridLayout(1, 2));
    topPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("PCIe Settings"),
            BorderFactory.createRaisedBevelBorder()));
    JPanel sPanel = new JPanel(new FlowLayout());
    sPanel.add(new JLabel("Link Speed: "));
    Object[] speeds = { "2.5 Gbps", "5.0 Gbps" };
    final PartialDisableComboBox lspeed = new PartialDisableComboBox();
    lspeed.addItems(speeds);//from  ww w  .ja  v  a  2s . c  om

    lspeed.setSelectedIndex(di.getPCIInfo().LinkSpeed - 1);
    lspeed.setItemEnabled(di.getPCIInfo().LinkSpeed - 1, false);

    sPanel.add(lspeed);
    JButton setSpeed = new JButton("Go");
    setSpeed.setToolTipText("This enables directed PCIe link speed change");
    setSpeed.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            if (lspeed.isItemEnabled(lspeed.getSelectedIndex())) {
                int ret = di.setLinkSpeed(lspeed.getSelectedIndex() + 1);
                if (ret == 0) {
                    //update pcie information
                    di.get_PCIstate();
                    lspeed.setItemEnabled(0, true);
                    lspeed.setItemEnabled(1, true);
                    lspeed.setSelectedIndex(di.getPCIInfo().LinkSpeed - 1);
                    lspeed.setItemEnabled(di.getPCIInfo().LinkSpeed - 1, false);
                    ptable.setData(di.getPCIInfo().getPCIData(), pcieColumnNames);
                    ptable.fireTableDataChanged();
                } else {
                    updateLog("Unable to set Link Speed " + lspeed.getSelectedItem(), keyWord);
                }
            }
        }
    });

    sPanel.add(setSpeed);
    topPanel.add(sPanel);

    JPanel sPanel1 = new JPanel(new FlowLayout());
    sPanel1.add(new JLabel("Link Width: "));
    Object[] widths = { "x1", "x2", "x4", "x8" };
    final PartialDisableComboBox lwidths = new PartialDisableComboBox();
    lwidths.addItems(widths);
    lwidths.setSelectedItem("x" + di.getPCIInfo().LinkWidth);
    lwidths.setItemEnabled(lwidths.getSelectedIndex(), false);
    sPanel1.add(lwidths);
    JButton setWidth = new JButton("Go");
    setWidth.setToolTipText("This enables directed PCIe link width change");
    setWidth.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            if (lwidths.isItemEnabled(lwidths.getSelectedIndex())) {
                int ret = di.setLinkWidth(lwidths.getSelectedIndex() + 1);
                if (ret == 0) {
                    //update pcie information
                    // some times width change affect link speed so
                    // enable the same in lspeedd also
                    di.get_PCIstate();
                    lwidths.setItemEnabled(0, true);
                    lwidths.setItemEnabled(1, true);
                    lwidths.setItemEnabled(2, true);
                    lwidths.setItemEnabled(3, true);
                    lwidths.setSelectedItem("x" + di.getPCIInfo().LinkWidth);
                    lwidths.setItemEnabled(lwidths.getSelectedIndex(), false);

                    // some times width change affect link speed so
                    // enable the same in lspeed also
                    lspeed.setItemEnabled(0, true);
                    lspeed.setItemEnabled(1, true);
                    lspeed.setSelectedIndex(di.getPCIInfo().LinkSpeed - 1);
                    lspeed.setItemEnabled(di.getPCIInfo().LinkSpeed - 1, false);

                    ptable.setData(di.getPCIInfo().getPCIData(), pcieColumnNames);
                    ptable.fireTableDataChanged();

                } else {
                    di.get_PCIstate();
                    int upCap = di.getPCIInfo().LinkUpCap;

                    if (upCap == 0)
                        updateLog("Unable to set Link Width " + lwidths.getSelectedItem()
                                + ". PCIe link not upconfigurable", keyWord);

                    else
                        updateLog("Unable to set Link Width " + lwidths.getSelectedItem(), keyWord);

                }
            }
        }
    });
    sPanel1.add(setWidth);
    topPanel.add(sPanel1);

    pciSystemPanel.add(topPanel);
    JPanel panel = new JPanel(new GridLayout(1, 2));

    JPanel pciPanel = new JPanel(new BorderLayout());
    pciPanel.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder("PCIe Endpoint Status"), BorderFactory.createRaisedBevelBorder()));
    ptable = new MyTableModel(di.getPCIInfo().getPCIData(), pcieColumnNames);
    pcieTable = new JTable(ptable);
    try {
        pcieTable.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
    } catch (Exception e) {
    }

    JTableHeader pcieHeader = pcieTable.getTableHeader();
    pcieHeader.setForeground(new Color(92, 25, 25));

    pciPanel.add(pcieHeader, BorderLayout.PAGE_START);
    pciPanel.add(pcieTable, BorderLayout.CENTER);

    panel.add(pciPanel);

    JPanel hostPanel = new JPanel(new BorderLayout());
    hostPanel.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder("Host System's Initial Credits"),
            BorderFactory.createRaisedBevelBorder()));
    htable = new MyTableModel(di.getPCIInfo().getHostedData(), pcieColumnNames);
    hostTable = new JTable(htable);
    try {
        hostTable.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
    } catch (Exception e) {
    }

    JTableHeader hostHeader = hostTable.getTableHeader();
    hostHeader.setForeground(new Color(92, 25, 25));

    hostPanel.add(hostHeader, BorderLayout.PAGE_START);
    hostPanel.add(hostTable, BorderLayout.CENTER);

    panel.add(hostPanel);

    pciSystemPanel.add(panel);

    pciSystemPanel.add(dialChart(pciSystemPanel.getWidth()));

    return pciSystemPanel;
}

From source file:io.heming.accountbook.ui.MainFrame.java

private void initStatusBar() {
    statusBar = Box.createHorizontalBox();
    statusBar.setPreferredSize(new Dimension(getWidth(), 26));
    statusBar.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0),
            BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)));

    ImageIcon loading = new ImageIcon(getClass().getResource("stopped-loader.png"));
    statusLabel = new JLabel("", loading, JLabel.LEFT);
    statusLabel.setHorizontalAlignment(SwingConstants.LEFT);

    statusBar.add(statusLabel);//from  w  w  w .ja  v  a 2  s .  co  m
    statusBar.add(Box.createHorizontalGlue());

    infoLabel = new JLabel();
    infoLabel.setForeground(Color.GRAY);
    infoLabel.setPreferredSize(new Dimension(270, 20));
    infoLabel.setMaximumSize(infoLabel.getPreferredSize());
    statusBar.add(infoLabel);
    statusBar.add(Box.createHorizontalStrut(20));

    pageLabel = new JLabel();
    pageLabel.setForeground(Color.GRAY);
    pageLabel.setPreferredSize(new Dimension(80, 20));
    pageLabel.setMaximumSize(pageLabel.getPreferredSize());
    statusBar.add(pageLabel);

    Insets insets = new Insets(2, 10, 2, 10);
    firstPageButton = new JButton();
    firstPageButton.setMargin(insets);
    firstPageButton.setActionCommand("");
    firstPageButton.setToolTipText("");
    firstPageButton.setIcon(new ImageIcon(getClass().getResource("go-first.png")));
    firstPageButton.addActionListener(e -> firstPage());

    prevPageButton = new JButton();
    prevPageButton.setMargin(insets);
    prevPageButton.setActionCommand("?");
    prevPageButton.setToolTipText("?");
    prevPageButton.setIcon(new ImageIcon(getClass().getResource("go-previous-2.png")));
    prevPageButton.addActionListener(e -> prevPage());

    nextPageButton = new JButton();
    nextPageButton.setMargin(insets);
    nextPageButton.setActionCommand("");
    nextPageButton.setToolTipText("");
    nextPageButton.setIcon(new ImageIcon(getClass().getResource("go-next-2.png")));
    nextPageButton.addActionListener(e -> nextPage());

    lastPageButton = new JButton();
    lastPageButton.setMargin(insets);
    lastPageButton.setActionCommand("");
    lastPageButton.setToolTipText("");
    lastPageButton.setIcon(new ImageIcon(getClass().getResource("go-last.png")));
    lastPageButton.addActionListener(e -> lastPage());

    statusBar.add(firstPageButton);
    statusBar.add(prevPageButton);
    statusBar.add(nextPageButton);
    statusBar.add(lastPageButton);

    add(statusBar, BorderLayout.SOUTH);
}

From source file:com.xilinx.virtex7.MainScreen.java

private JPanel testAndStats() {
    JPanel tstats = new JPanel();
    tstats.setLayout(new BoxLayout(tstats, BoxLayout.Y_AXIS));

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

    tstats1.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""),
            BorderFactory.createRaisedBevelBorder()));

    tstats1.add(testPanelItems());/*w  ww .  j  av a 2  s . c  o  m*/

    JPanel dmaInner = new JPanel(new BorderLayout());

    JPanel dmaPanel = new JPanel(new BorderLayout());

    dmaPanel.setBackground(new Color(130, 170, 180));
    table1 = new MyTableModel(dummy_data, dmaColumnNames0);
    dmaStats1 = new JTable(table1);
    try {
        dmaStats1.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
    } catch (Exception e) {
    }
    JTableHeader dmaHeader = dmaStats1.getTableHeader();
    dmaHeader.setForeground(new Color(92, 25, 25));

    dmaPanel.add(dmaHeader, BorderLayout.PAGE_START);
    dmaPanel.add(dmaStats1, BorderLayout.CENTER);
    dmaInner.add(dmaPanel, BorderLayout.CENTER);
    tstats1.add(dmaInner);
    tstats.add(tstats1);

    //tstats.add(trnPanel);

    JPanel tstats2 = new JPanel();
    tstats2.setLayout(new BoxLayout(tstats2, BoxLayout.Y_AXIS));
    tstats2.add(testPanelItems1());

    tstats2.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""),
            BorderFactory.createRaisedBevelBorder()));

    JPanel dmaPanel1 = new JPanel(new BorderLayout());

    table2 = new MyTableModel(dummy_data, dmaColumnNames1);
    dmaStats2 = new JTable(table2);
    try {
        dmaStats2.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
    } catch (Exception e) {
    }
    JTableHeader dmaHeader1 = dmaStats2.getTableHeader();
    dmaHeader1.setForeground(new Color(92, 25, 25));

    dmaPanel1.add(dmaHeader1, BorderLayout.PAGE_START);
    dmaPanel1.add(dmaStats2, BorderLayout.CENTER);
    tstats2.add(dmaPanel1);
    tstats.add(tstats2);

    return tstats;
}

From source file:base.BasePlayer.Main.java

public Main() {

    super(new GridBagLayout());
    try {/* w  w w  . j av a 2s  .c  om*/

        //UIManager.put("PopupMenu.border", BorderFactory.createMatteBorder(0, 20, 0, 0, new Color(230,230,230)));
        //URL fontUrl = new URL("http://www.webpagepublicity.com/" +
        //       "free-fonts/a/Airacobra%20Condensed.ttf");
        //      URL fontUrl = new URL("C:/HY-Data/RKATAINE/WinPython-64bit-3.5.3.1Qt5/python-3.5.3.amd64/share/numdifftools/docs/_build/html/_static/fonts/Inconsolata-Regular.ttf");
        //   URL fonturl = this.getClass().getResource("OpenSans-Regular.ttf");
        //   menuFont = Font.createFont(Font.TRUETYPE_FONT, new File(fonturl.getFile()));
        //   C:\HY-Data\RKATAINE\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\Lib\site-packages\reportlab\fonts
        Launcher.fromMain = true;
        Launcher.main(args);
        VariantHandler.main(argsit);
        glass = Toolkit.getDefaultToolkit().getImage(getClass().getResource("icons/glass.jpg"));
        ToolTipManager.sharedInstance().setInitialDelay(100);
        // ToolTipManager.sharedInstance().setDismissDelay(2000);
        UIManager.put("ToolTip.background", new Color(255, 255, 214));
        UIManager.put("ToolTip.border", BorderFactory.createCompoundBorder(
                UIManager.getBorder("ToolTip.border"), BorderFactory.createEmptyBorder(4, 4, 4, 4)));
        lineseparator = System.getProperty("line.separator");

        proxysettings = new ProxySettings();
        panel = new JPanel(new GridBagLayout());
        //menuFont = menuFont.deriveFont(Font.PLAIN,12);
        Draw.defaultFont = menuFont;

        gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
        width = gd.getDisplayMode().getWidth();
        height = gd.getDisplayMode().getHeight();
        if (Launcher.fontSize.equals("")) {
            if (width < 1500) {
                defaultFontSize = 11;

                buttonHeight = Main.defaultFontSize * 2;
                buttonWidth = Main.defaultFontSize * 6;

            } else if (width < 2000) {
                defaultFontSize = 12;

                buttonHeight = Main.defaultFontSize * 2 + 4;
                buttonWidth = Main.defaultFontSize * 6 + 4;

            } else if (width < 3000) {
                defaultFontSize = 15;
                buttonHeight = Main.defaultFontSize * 2 + 4;
                buttonWidth = Main.defaultFontSize * 6 + 4;
            } else {
                defaultFontSize = 19;
                buttonHeight = Main.defaultFontSize * 2 + 4;
                buttonWidth = Main.defaultFontSize * 6 + 4;
            }
        } else {
            try {
                defaultFontSize = Integer.parseInt(Launcher.fontSize);
            } catch (Exception e) {
                defaultFontSize = 12;
            }
        }

        menuFont = new Font("SansSerif", Font.PLAIN, Main.defaultFontSize);
        menuFontBold = new Font("SansSerif", Font.BOLD, Main.defaultFontSize);
        //   menuFont = new Font("SansSerif", Font.BOLD, Main.defaultFontSize);
    } catch (Exception e) {
        e.printStackTrace();
    }
    FileSystemView fsv = FileSystemView.getFileSystemView();
    File[] paths = File.listRoots();

    for (File path : paths) {
        if (fsv.getSystemDisplayName(path).contains("merit")) {
            pleiades = true;
        }
    }

    screenSize = new Dimension(width, height);

    drawHeight = (int) (screenSize.getHeight() * 0.6);
    sidebarWidth = (int) (screenSize.getWidth() * 0.1);
    drawWidth = (int) (screenSize.getWidth() - sidebarWidth);
    thisMainListener = this;
    try {
        htsjdk.samtools.util.Log.setGlobalLogLevel(htsjdk.samtools.util.Log.LogLevel.ERROR);
        /*   for(int i=0;i<snow.length; i++) {
              snow[i][0] = (height*Math.random());
              snow[i][1] = (4*Math.random() +1);
              snow[i][2] = (12*Math.random() -6);
              snow[i][3] = (2*Math.random() +1);
           }*/
        frame.addWindowListener(new java.awt.event.WindowAdapter() {
            @Override
            public void windowClosing(java.awt.event.WindowEvent windowEvent) {
                /*if (JOptionPane.showConfirmDialog(frame, "Are you sure to close this window?", "Really Closing?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION){
                    System.exit(0);
                }*/
                if (configChanged) {

                    try {
                        BufferedWriter fileWriter = new BufferedWriter(new FileWriter(Launcher.configfile));
                        for (int i = 0; i < Launcher.config.size(); i++) {
                            fileWriter.write(Launcher.config.get(i) + lineseparator);
                        }
                        fileWriter.close();

                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }

            }
        });
        baseMap.put((byte) 'A', 1);
        baseMap.put((byte) 'C', 2);
        baseMap.put((byte) 'G', 3);
        baseMap.put((byte) 'T', 4);
        baseMap.put((byte) 'N', 5);
        baseMap.put((byte) 'I', 6);
        baseMap.put((byte) 'D', 7);
        mutTypes.put("TA", 0);
        mutTypes.put("AT", 0);
        mutTypes.put("TC", 1);
        mutTypes.put("AG", 1);
        mutTypes.put("TG", 2);
        mutTypes.put("AC", 2);
        mutTypes.put("CA", 3);
        mutTypes.put("GT", 3);
        mutTypes.put("CG", 4);
        mutTypes.put("GC", 4);
        mutTypes.put("CT", 5);
        mutTypes.put("GA", 5);

        getBase.put((byte) 'A', "A");
        getBase.put((byte) 'C', "C");
        getBase.put((byte) 'G', "G");
        getBase.put((byte) 'T', "T");
        getBase.put((byte) 'N', "N");
        getBase.put((byte) 'a', "A");
        getBase.put((byte) 'c', "C");
        getBase.put((byte) 'g', "G");
        getBase.put((byte) 't', "T");
        getBase.put((byte) 'n', "N");
        java.net.URL imgUrl = getClass().getResource("icons/save.gif");
        save = new ImageIcon(imgUrl);
        imgUrl = getClass().getResource("icons/open.gif");
        open = new ImageIcon(imgUrl);
        imgUrl = getClass().getResource("icons/settings.png");
        settingsIcon = new ImageIcon(imgUrl);
        userDir = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent()
                .replace("%20", " ");
        settings = new JMenuItem("Settings", settingsIcon);

        //   Average.frame.setVisible(false);

        try {

            savedir = Launcher.defaultSaveDir;
            path = Launcher.defaultDir;
            gerp = Launcher.gerpfile;
            defaultGenome = Launcher.defaultGenome;
            defaultAnnotation = Launcher.defaultAnnotation;
            isProxy = Launcher.isProxy;
            proxyHost = Launcher.proxyHost;
            proxyPort = Launcher.proxyPort;
            proxyType = Launcher.proxyType;
            if (isProxy) {
                ProxySettings.useProxy.setSelected(true);
            }
            if (!proxyHost.equals("")) {
                ProxySettings.hostField.setText(proxyHost);
            }
            if (!proxyPort.equals("")) {
                ProxySettings.portField.setText(proxyPort);
            }
            if (!Launcher.proxyType.equals("")) {
                ProxySettings.proxytypes.setSelectedItem(proxyType);
            }
            if (Launcher.backColor.equals("")) {
                Draw.backColor = new Color(90, 90, 90);
            }

            else {

                Draw.backColor = new Color(Integer.parseInt(Launcher.backColor),
                        Integer.parseInt(Launcher.backColor), Integer.parseInt(Launcher.backColor));
                Settings.graySlider.setValue(Integer.parseInt(Launcher.backColor));
            }

            if (Launcher.genomeDir.equals("")) {

                genomeDir = new File(userDir + "/genomes/");
            } else {
                if (new File(Launcher.genomeDir).exists()) {

                    genomeDir = new File(Launcher.genomeDir);
                } else {
                    genomeDir = new File(userDir + "/genomes/");
                }
            }

            annotationfile = defaultAnnotation;
            controlDir = Launcher.ctrldir;
            trackDir = Launcher.trackDir;
            projectDir = Launcher.projectDir;
            downloadDir = Launcher.downloadDir;
        } catch (Exception e) {
            e.printStackTrace();
        }
        File[] genomes = genomeDir.listFiles(new FilenameFilter() {
            public boolean accept(File dir, String name) {
                return !name.contains(".txt") && !name.startsWith(".");
            }
        });
        chromHeight = (int) (drawHeight * 0.1);
        drawDimensions = new Dimension(drawWidth, drawHeight - chromHeight);
        bedDimensions = new Dimension(drawWidth, bedHeight);
        chromDimensions = new Dimension(drawWidth - Main.sidebarWidth - 1, drawHeight);
        drawCanvas = new Draw((int) drawDimensions.getWidth(), (int) drawDimensions.getHeight());
        controlDraw = new ControlCanvas((int) bedDimensions.getWidth(), (int) bedDimensions.getHeight());
        iconImage = Toolkit.getDefaultToolkit().getImage(getClass().getResource("icons/icon.png"));
        frame.setIconImage(iconImage);
        /*   if(args.length > 0) {
               for(int i = 0; i<args.length; i++) {
                  if(args[i].startsWith("-opendir")) {
                     path = args[i].substring(9).replace(" ", "");
                  }
                  else if(args[i].startsWith("-ctrldir")) {
                     Control.path = args[i].substring(9).replace(" ", "");
                  }             
               }       
            }*/

        //   BGZIPInputStream in = this.getClass().getResourceAsStream("SELEX_1505_representative_matrices.bedhead.gz");
        searchField.getDocument().addDocumentListener(new DocumentListener() {
            private String searchstring;

            public void changedUpdate(DocumentEvent e) {
                if (searchField.getText().contains(";")) {
                    searchList = searchField.getText().split(";");
                    for (int i = 0; i < searchList.length; i++) {
                        warn(searchList[i].replace(" ", ""));
                    }
                } else {
                    warn(searchField.getText().replace(" ", ""));
                }

            }

            public void removeUpdate(DocumentEvent e) {
                if (searchField.getText().contains(";")) {
                    searchList = searchField.getText().split(";");
                    for (int i = 0; i < searchList.length; i++) {
                        warn(searchList[i].replace(" ", ""));
                    }
                } else {
                    warn(searchField.getText().replace(" ", ""));
                }
            }

            public void insertUpdate(DocumentEvent e) {
                if (searchField.getText().contains(";")) {
                    searchList = searchField.getText().split(";");
                    for (int i = 0; i < searchList.length; i++) {
                        warn(searchList[i].replace(" ", ""));
                    }
                } else {
                    warn(searchField.getText().replace(" ", ""));
                }
            }

            public void warn(String searchtext) {

                if (searchTable.containsKey(searchtext.toUpperCase())) {
                    if (searchTable.get(searchtext.toUpperCase())[0]
                            .equals(Main.chromosomeDropdown.getSelectedItem())) {
                        searchChrom = searchTable.get(searchtext.toUpperCase())[0];
                        searchStart = Integer.parseInt(searchTable.get(searchtext.toUpperCase())[1]);
                        searchEnd = Integer.parseInt(searchTable.get(searchtext.toUpperCase())[2]);
                    } else {
                        chromDraw.repaint();
                        searchStart = -1;
                        searchEnd = -1;
                    }
                    chromDraw.repaint();
                    searchField.setForeground(Color.black);
                } else if (searchField.getText().toUpperCase().matches("CHR.{1,2}(?!:)")) {

                    if (Main.chromnamevector.contains(searchtext.toUpperCase().substring(3))) {
                        searchField.setForeground(Color.black);

                    } else {
                        chromDraw.repaint();
                        searchField.setForeground(Color.red);
                    }
                } else if (searchtext.toUpperCase().replace(",", "").matches("(CHR)?(.+:)?\\d+(-\\d+)?")) {

                    searchField.setForeground(Color.black);
                    if (searchtext.contains(":")) {
                        searchstring = searchtext.substring(searchtext.indexOf(":") + 1).replace(",", "");
                    } else {
                        chromDraw.repaint();
                        searchstring = searchtext.replace(",", "");
                    }

                    if (!searchstring.contains("-")) {
                        try {
                            searchStart = Integer.parseInt(searchstring);
                        } catch (Exception ex) {

                        }
                        searchEnd = -1;
                    } else {
                        try {
                            searchStart = Integer
                                    .parseInt(searchstring.substring(0, searchstring.indexOf("-")));
                            searchEnd = Integer.parseInt(searchstring.substring(searchstring.indexOf("-") + 1));
                        } catch (Exception ex) {

                        }
                    }
                    chromDraw.repaint();

                } else {
                    chromDraw.repaint();
                    searchField.setForeground(Color.red);
                    searchStart = -1;
                    searchEnd = -1;
                }
            }
        });

        try {

            A = Toolkit.getDefaultToolkit().getImage(getClass().getResource("SELEX/A.png"));
            C = Toolkit.getDefaultToolkit().getImage(getClass().getResource("SELEX/C.png"));
            G = Toolkit.getDefaultToolkit().getImage(getClass().getResource("SELEX/G.png"));
            T = Toolkit.getDefaultToolkit().getImage(getClass().getResource("SELEX/T.png"));

        } catch (Exception e) {
            e.printStackTrace();
        }
        ErrorLog.main(args);

        this.setBackground(Color.black);
        UIManager.put("FileChooser.readOnly", Boolean.TRUE);

        panel.setBackground(Draw.sidecolor);
        panel.setBorder(BorderFactory.createLineBorder(Color.white));
        searchField.addKeyListener(this);

        frame.addKeyListener(this);
        frame.getContentPane().setBackground(Color.black);

        glassPane.addMouseListener(this);
        glassPane.addMouseMotionListener(new MouseMotionListener() {

            @Override
            public void mouseDragged(MouseEvent arg0) {

            }

            @Override
            public void mouseMoved(MouseEvent event) {

                // g.drawRect(drawScroll.getWidth()/2-Main.canceltextwidth/2-Main.defaultFontSize/2, Main.drawScroll.getViewport().getHeight()*2/3+Draw.loadingFont.getSize()*3-Main.defaultFontSize/4, Main.canceltextwidth+Main.defaultFontSize, Draw.loadingFont.getSize()+Main.defaultFontSize/2);                

                if (drawCanvas.loading
                        && event.getX() > drawScroll.getWidth() / 2 - Main.canceltextwidth / 2
                                - Main.defaultFontSize / 2
                        && event.getX() < drawScroll.getWidth() / 2 + Main.canceltextwidth / 2
                                + Main.defaultFontSize / 2
                        && event.getY() > frame.getHeight() * 1 / 3 + Draw.loadingFont.getSize() * 3
                                - Main.defaultFontSize / 4
                        && event.getY() < frame.getHeight() * 1 / 3 + Draw.loadingFont.getSize() * 4
                                + Main.defaultFontSize / 2) {
                    if (!Main.cancelhover) {
                        Main.cancelhover = true;
                        Main.glassPane.requestFocus();
                    }
                } else {
                    if (Main.cancelhover) {
                        Main.cancelhover = false;
                        Main.glassPane.requestFocus(false);
                    }
                }
            }
        });

        background.put((byte) 'A', 0.3);
        background.put((byte) 'C', 0.2);
        background.put((byte) 'G', 0.2);
        background.put((byte) 'T', 0.3);

        bases = new Hashtable<String, String>();
        bases.put("A", "A");
        bases.put("C", "C");
        bases.put("G", "G");
        bases.put("T", "T");
        bases.put("N", "N");
        bases.put("delA", "delA");
        bases.put("delC", "delC");
        bases.put("delG", "delG");
        bases.put("delT", "delT");
        bases.put("insA", "insA");
        bases.put("insC", "insC");
        bases.put("insG", "insG");
        bases.put("insT", "insT");

        chromDraw = new ChromDraw(drawWidth, chromHeight);

        VariantCaller.main(argsit);
        PeakCaller.main(argsit);
        tablebrowser = new TableBrowser();
        bedconverter = new BEDconvert();

        try {

            File annodir;

            File[] annotations;
            addGenome.addMouseListener(this);
            genome = new JMenu("Genomes");
            genome.setName("genomeMenu");
            genome.add(addGenome);
            genome.addComponentListener(this);
            File[] fastadir;
            String[] empty = {};

            refModel = new DefaultComboBoxModel<String>(empty);

            refDropdown = new SteppedComboBox(refModel);
            refDropdown.addMouseListener(this);
            String[] emptygenes = {};
            refDropdown.addActionListener(refDropActionListener);

            geneModel = new DefaultComboBoxModel<String>(emptygenes);
            geneDropdown = new SteppedComboBox(geneModel);
            geneDropdown.addMouseListener(this);
            if (genomes != null) {
                for (int i = 0; i < genomes.length; i++) {
                    if (!genomes[i].isDirectory()) {
                        continue;
                    }
                    annodir = new File(genomes[i].getAbsolutePath() + "/annotation/");
                    if (genomes[i].isDirectory()) {
                        fastadir = genomes[i].listFiles();
                        for (int f = 0; f < fastadir.length; f++) {
                            if (fastadir[f].isDirectory()) {
                                continue;
                            }
                            if (fastadir[f].getName().contains(".fai")) {
                                continue;
                            } else if (fastadir[f].getName().contains(".fa")) {
                                fastahash.put(genomes[i].getName(), fastadir[f]);
                            }
                        }
                    }

                    annotations = annodir.listFiles();
                    genomehash.put(genomes[i].getName(), new ArrayList<File>());

                    refModel.addElement(genomes[i].getName());
                    if (genomes[i].getName().length() > reflength) {
                        reflength = genomes[i].getName().length();
                    }
                    JMenu addMenu = new JMenu(genomes[i].getName());
                    addMenu.addMouseListener(this);
                    addMenu.setName(genomes[i].getName());
                    JMenuItem addAnnotation = new JMenuItem("Add new annotation file...");
                    addAnnotation.addMouseListener(this);
                    addAnnotation.setName("add_annotation");
                    addMenu.add(addAnnotation);
                    JLabel addLabel = new JLabel("  Select annotation: ");
                    labels.add(addLabel);
                    addMenu.add(addLabel);
                    addMenu.add(new JSeparator());

                    genome.add(addMenu);
                    addMenu.addComponentListener(this);
                    if (annotations != null) {
                        for (int j = 0; j < annotations.length; j++) {
                            annofiles = annotations[j].listFiles();
                            for (int f = 0; f < annofiles.length; f++) {
                                if (annofiles[f].getName().endsWith(".bed.gz")) {
                                    if (annofiles[f].getName()
                                            .substring(0, annofiles[f].getName().indexOf(".bed.gz"))
                                            .length() > annolength) {
                                        annolength = annofiles[f].getName().length();
                                    }

                                    genomehash.get(genomes[i].getName()).add(annofiles[f].getAbsoluteFile());
                                    JMenuItem additem = new JMenuItem(annofiles[f].getName().substring(0,
                                            annofiles[f].getName().indexOf(".bed.gz")));
                                    additem.setName(annofiles[f].getName().substring(0,
                                            annofiles[f].getName().indexOf(".bed.gz")));
                                    additem.addMouseListener(this);
                                    addMenu.add(additem);
                                    additem.addComponentListener(this);
                                    break;
                                }
                            }
                        }
                    }
                }
                refModel.addElement("Add new reference...");

            }

            if (genomes.length == 0) {
                /*if(Launcher.firstStart) {
                   Main.writeToConfig("FirstStart=false");
                }*/
                AddGenome.createAndShowGUI();
                AddGenome.frame.setTitle("Add new genome");

                AddGenome.remove.setEnabled(false);
                AddGenome.download.setEnabled(false);

                AddGenome.frame.setLocation((int) (screenSize.getWidth() / 2 - AddGenome.frame.getWidth() / 2),
                        (int) (screenSize.getHeight() / 6));

                AddGenome.frame.setState(JFrame.NORMAL);
                AddGenome.frame.setVisible(true);
                AddGenome.frame.setAlwaysOnTop(true);
                /*
                WelcomeScreen.main(args);
                WelcomeScreen.frame.setVisible(true);
                WelcomeScreen.frame.setLocation(frame.getLocationOnScreen().x+frame.getWidth()/2 - WelcomeScreen.frame.getWidth()/2, frame.getLocationOnScreen().y+frame.getHeight()/6);
                */
                if (genomes.length != 0) {
                    if (!genomehash.containsKey(defaultGenome)) {

                        setChromDrop(genomes[0].getName());
                        defaultGenome = genomes[0].getName();
                    } else {

                        setChromDrop(defaultGenome);
                    }
                    getBands();
                    getExons();
                } else {
                    setChromDrop(null);
                }
            } else {
                if (!genomehash.containsKey(defaultGenome)) {

                    setChromDrop(genomes[0].getName());
                    defaultGenome = genomes[0].getName();

                } else {

                    setChromDrop(defaultGenome);
                }
                getBands();
                getExons();
            }

            if (Launcher.firstStart) {

                WelcomeScreen.createAndShowGUI();
                WelcomeScreen.frame.setLocation(
                        (int) (screenSize.getWidth() / 2 - WelcomeScreen.frame.getWidth() / 2),
                        (int) (screenSize.getHeight() / 6));
                WelcomeScreen.frame.setVisible(true);
            }
            setMenuBar();
            setButtons();
            Settings.main(args);

            // Settings.main(args);
            frame.requestFocus();

            drawCanvas.addKeyListener(this);
            bedCanvas.addKeyListener(this);
            setFonts();
            chromLabel.setText("Chromosome " + chromosomeDropdown.getSelectedItem().toString());
            CheckUpdates check = new CheckUpdates();
            check.execute();
            //   Main.drawCanvas.loading("test");
            Main.drawCanvas.splits.get(0)
                    .setCytoImage(Main.chromDraw.createBands(Main.drawCanvas.splits.get(0)));
        } catch (Exception e) {
            e.printStackTrace();
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        Main.showError(ex.getMessage(), "Error");

    }

}

From source file:com.xilinx.virtex7.MainScreen.java

private JPanel messageBox() {
    JPanel tstats3 = new JPanel(new BorderLayout());
    /*tstats3.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createTitledBorder("Message Log"),
                BorderFactory.createRaisedBevelBorder()));*/
    JPanel trnPanel = new JPanel(new GridLayout(1, 1));
    trnPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("PCIe Statistics"),
            BorderFactory.createRaisedBevelBorder()));
    JPanel trn1 = new JPanel(new FlowLayout());
    trn1.add(new JLabel("Transmit (writes in Gbps): "));
    trnLTX = new JTextField("0.0", 5);
    trnLTX.setEditable(false);/*  w ww.jav  a  2  s. c o  m*/
    trn1.add(trnLTX);
    trn1.add(new JLabel("Receive (reads in Gbps): "));
    trnLRX = new JTextField("0.0", 5);
    trnLRX.setEditable(false);
    trn1.add(trnLRX);
    trnPanel.add(trn1);

    textArea = new CustomTextPane();

    final JScrollPane scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Message Log"),
            BorderFactory.createRaisedBevelBorder()));
    scrollPane.setPreferredSize(new Dimension(scrollPane.getPreferredSize().width, 100));
    //scrollPane.setMaximumSize(new Dimension(scrollPane.getPreferredSize().width, 100));  
    // keep scrollbar at end showing latest messages
    /*scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
    BoundedRangeModel brm = scrollPane.getVerticalScrollBar().getModel();
    boolean wasAtBottom = true;
    @Override
    public void adjustmentValueChanged(AdjustmentEvent ae) {
        if (!brm.getValueIsAdjusting() &&
                 (scrollPane.) == brm.getMaximum()) {
            if (wasAtBottom)
                brm.setValue(brm.getMaximum());
                       
         } else
                wasAtBottom = ((brm.getValue() + brm.getExtent()) == brm.getMaximum());
            
        }
    });*/

    textArea.setEditable(false);

    tstats3.add(scrollPane, BorderLayout.CENTER);

    tstats3.add(trnPanel, BorderLayout.PAGE_START);
    return tstats3;
    // testPanel.add(tstats3, BorderLayout.PAGE_END);
}