Example usage for java.awt GridBagConstraints NONE

List of usage examples for java.awt GridBagConstraints NONE

Introduction

In this page you can find the example usage for java.awt GridBagConstraints NONE.

Prototype

int NONE

To view the source code for java.awt GridBagConstraints NONE.

Click Source Link

Document

Do not resize the component.

Usage

From source file:de.huxhorn.lilith.swing.MainFrame.java

public MainFrame(ApplicationPreferences applicationPreferences, SplashScreen splashScreen, String appName,
        boolean enableBonjour) {
    super(appName);
    this.applicationPreferences = applicationPreferences;
    this.coloringWholeRow = this.applicationPreferences.isColoringWholeRow();
    this.splashScreen = splashScreen;
    setSplashStatusText("Creating main frame.");

    groovyFormatter = new GroovyEventWrapperHtmlFormatter(applicationPreferences);
    thymeleafFormatter = new ThymeleafEventWrapperHtmlFormatter(applicationPreferences);

    smallProgressIcon = new ImageIcon(MainFrame.class.getResource("/otherGraphics/Progress16.gif"));
    ImageIcon frameIcon = new ImageIcon(MainFrame.class.getResource("/otherGraphics/Lilith16.jpg"));
    setIconImage(frameIcon.getImage());/*from   w ww.j  a va  2s  .co m*/
    //colorsReferenceQueue=new ReferenceQueue<Colors>();
    //colorsCache=new ConcurrentHashMap<EventIdentifier, SoftColorsReference>();
    application = new DefaultApplication();
    autostartProcesses = new ArrayList<AutostartRunnable>();

    addWindowListener(new MainWindowListener());
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); // fixes ticket #79 
    Runtime runtime = Runtime.getRuntime();
    Thread shutdownHook = new Thread(new ShutdownRunnable());
    runtime.addShutdownHook(shutdownHook);

    senderService = new SenderService(this);
    this.enableBonjour = enableBonjour;
    /*
    if(application.isMac())
    {
       setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    }
    else
    {
       setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
      */

    longTaskManager = new TaskManager<Long>();
    longTaskManager.setUsingEventQueue(true);
    longTaskManager.startUp();
    longTaskManager.addTaskListener(new MainTaskListener());

    startupApplicationPath = this.applicationPreferences.getStartupApplicationPath();

    loggingFileFactory = new LogFileFactoryImpl(new File(startupApplicationPath, LOGGING_FILE_SUBDIRECTORY));
    accessFileFactory = new LogFileFactoryImpl(new File(startupApplicationPath, ACCESS_FILE_SUBDIRECTORY));

    Map<String, String> loggingMetaData = new HashMap<String, String>();
    loggingMetaData.put(FileConstants.CONTENT_TYPE_KEY, FileConstants.CONTENT_TYPE_VALUE_LOGGING);
    loggingMetaData.put(FileConstants.CONTENT_FORMAT_KEY, FileConstants.CONTENT_FORMAT_VALUE_PROTOBUF);
    loggingMetaData.put(FileConstants.COMPRESSION_KEY, FileConstants.COMPRESSION_VALUE_GZIP);
    // TODO: configurable format and compressed

    loggingFileBufferFactory = new LoggingFileBufferFactory(loggingFileFactory, loggingMetaData);

    Map<String, String> accessMetaData = new HashMap<String, String>();
    accessMetaData.put(FileConstants.CONTENT_TYPE_KEY, FileConstants.CONTENT_TYPE_VALUE_ACCESS);
    accessMetaData.put(FileConstants.CONTENT_FORMAT_KEY, FileConstants.CONTENT_FORMAT_VALUE_PROTOBUF);
    accessMetaData.put(FileConstants.COMPRESSION_KEY, FileConstants.COMPRESSION_VALUE_GZIP);
    // TODO: configurable format and compressed

    accessFileBufferFactory = new AccessFileBufferFactory(accessFileFactory, accessMetaData);

    rrdFileFilter = new RrdFileFilter();

    loggingEventViewManager = new LoggingEventViewManager(this);
    accessEventViewManager = new AccessEventViewManager(this);
    this.applicationPreferences.addPropertyChangeListener(new PreferencesChangeListener());
    loggingSourceListener = new LoggingEventSourceListener();
    accessSourceListener = new AccessEventSourceListener();
    // this.cleanupWindowChangeListener = new CleanupWindowChangeListener();
    desktop = new JDesktopPane();
    statusBar = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    statusLabel = new JLabel();
    statusLabel.setText("Starting...");

    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 0.0;
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.insets = new Insets(0, 5, 0, 0);

    statusBar.add(statusLabel, gbc);

    taskStatusLabel = new JLabel();
    taskStatusLabel.setText("");
    taskStatusLabel.setForeground(Color.BLUE);
    taskStatusLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent mouseEvent) {
            showTaskManager();
        }

        @Override
        public void mouseEntered(MouseEvent mouseEvent) {
            taskStatusLabel.setForeground(Color.RED);
        }

        @Override
        public void mouseExited(MouseEvent mouseEvent) {
            taskStatusLabel.setForeground(Color.BLUE);
        }
    });
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.insets = new Insets(0, 5, 0, 0);
    statusBar.add(taskStatusLabel, gbc);

    MemoryStatus memoryStatus = new MemoryStatus();
    memoryStatus.setBackground(Color.WHITE);
    memoryStatus.setOpaque(true);
    memoryStatus.setUsingBinaryUnits(true);
    memoryStatus.setUsingTotal(false);
    memoryStatus.setBorder(new EtchedBorder(EtchedBorder.LOWERED));

    gbc.fill = GridBagConstraints.NONE;
    gbc.gridx = 2;
    gbc.gridy = 0;
    gbc.weightx = 0.0;
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.insets = new Insets(0, 0, 0, 0);

    statusBar.add(memoryStatus, gbc);
    add(desktop, BorderLayout.CENTER);
    add(statusBar, BorderLayout.SOUTH);

    if (SystemUtils.IS_JAVA_1_6) {
        setSplashStatusText("Creating statistics dialog.");
        if (logger.isDebugEnabled())
            logger.debug("Before creation of statistics-dialog...");
        statisticsDialog = new StatisticsDialog(this);
        if (logger.isDebugEnabled())
            logger.debug("After creation of statistics-dialog...");
    }

    setSplashStatusText("Creating about dialog.");
    aboutDialog = new AboutDialog(this, "About " + appName + "...", appName);

    setSplashStatusText("Creating update dialog.");
    checkForUpdateDialog = new CheckForUpdateDialog(this);

    setSplashStatusText("Creating debug dialog.");
    debugDialog = new DebugDialog(this, this);

    setSplashStatusText("Creating preferences dialog.");
    if (logger.isDebugEnabled())
        logger.debug("Before creation of preferences-dialog...");
    preferencesDialog = new PreferencesDialog(this);
    if (logger.isDebugEnabled())
        logger.debug("After creation of preferences-dialog...");

    setSplashStatusText("Creating \"Open inactive\" dialog.");
    openInactiveLogsDialog = new OpenPreviousDialog(MainFrame.this);

    setSplashStatusText("Creating help frame.");
    helpFrame = new HelpFrame(this);
    helpFrame.setTitle("Help Topics");

    openFileChooser = new JFileChooser();
    openFileChooser.setFileFilter(new LilithFileFilter());
    openFileChooser.setFileHidingEnabled(false);
    openFileChooser.setCurrentDirectory(this.applicationPreferences.getPreviousOpenPath());

    importFileChooser = new JFileChooser();
    importFileChooser.setFileFilter(new XmlImportFileFilter());
    importFileChooser.setFileHidingEnabled(false);
    importFileChooser.setCurrentDirectory(this.applicationPreferences.getPreviousImportPath());

    exportFileChooser = new JFileChooser();
    exportFileChooser.setFileFilter(new LilithFileFilter());
    exportFileChooser.setFileHidingEnabled(false);
    exportFileChooser.setCurrentDirectory(this.applicationPreferences.getPreviousExportPath());

    setSplashStatusText("Creating task manager frame.");
    taskManagerFrame = new TaskManagerInternalFrame(this);
    taskManagerFrame.setTitle("Task Manager");
    taskManagerFrame.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE);
    taskManagerFrame.setBounds(0, 0, 320, 240);

    desktop.add(taskManagerFrame);
    desktop.validate();

    // the following code must be executed after desktop has been initialized...
    try {
        // try to use the 1.6 transfer handler...
        new MainFrameTransferHandler16(this).attach();
    } catch (Throwable t) {
        // ... and use the basic 1.5 transfer handler if this fails.
        new MainFrameTransferHandler(this).attach();
    }

    setSplashStatusText("Creating Tip of the Day dialog.");
    tipOfTheDayDialog = new TipOfTheDayDialog(this);

    setSplashStatusText("Creating actions and menus.");
    viewActions = new ViewActions(this, null);
    viewActions.getPopupMenu(); // initialize popup once in main frame only.

    JMenuBar menuBar = viewActions.getMenuBar();
    toolbar = viewActions.getToolbar();
    add(toolbar, BorderLayout.NORTH);
    setJMenuBar(menuBar);

    setShowingToolbar(applicationPreferences.isShowingToolbar());
    setShowingStatusbar(applicationPreferences.isShowingStatusbar());
}

From source file:org.revager.gui.findings_list.FindingsListFrame.java

private void createAttPanel() {
    GridLayout grid = new GridLayout(4, 1);
    grid.setVgap(8);//from w  w w. j ava2s .  c om

    JPanel attendeeButtons = new JPanel(grid);

    addResiAtt = GUITools.newImageButton();
    addResiAtt.setIcon(Data.getInstance().getIcon("addResiAtt_25x25_0.png"));
    addResiAtt.setRolloverIcon(Data.getInstance().getIcon("addResiAtt_25x25.png"));
    addResiAtt.setToolTipText(translate("Add Attendee from the Attendee Pool"));
    addResiAtt.addActionListener(ActionRegistry.getInstance().get(AddResiAttToProtAction.class.getName()));
    attendeeButtons.add(addResiAtt);

    JButton addAttendee = GUITools.newImageButton();
    addAttendee.setIcon(Data.getInstance().getIcon("addAttendee_25x25_0.png"));
    addAttendee.setRolloverIcon(Data.getInstance().getIcon("addAttendee_25x25.png"));
    addAttendee.setToolTipText(translate("Add Attendee"));
    addAttendee.addActionListener(ActionRegistry.getInstance().get(AddAttToProtAction.class.getName()));
    attendeeButtons.add(addAttendee);

    removeAttendee = GUITools.newImageButton();
    removeAttendee.setIcon(Data.getInstance().getIcon("removeAttendee_25x25_0.png"));
    removeAttendee.setRolloverIcon(Data.getInstance().getIcon("removeAttendee_25x25.png"));
    removeAttendee.setToolTipText(translate("Remove Attendee"));
    removeAttendee.addActionListener(ActionRegistry.getInstance().get(RemAttFromProtAction.class.getName()));
    attendeeButtons.add(removeAttendee);

    editAttendee = GUITools.newImageButton();
    editAttendee.setIcon(Data.getInstance().getIcon("editAttendee_25x25_0.png"));
    editAttendee.setRolloverIcon(Data.getInstance().getIcon("editAttendee_25x25.png"));
    editAttendee.setToolTipText(translate("Edit Attendee"));
    editAttendee.addActionListener(ActionRegistry.getInstance().get(EditAttFromProtAction.class.getName()));
    attendeeButtons.add(editAttendee);

    editAttendee.setEnabled(false);
    removeAttendee.setEnabled(false);

    presentAttTable.setRowHeight(55);
    presentAttTable.getColumnModel().getColumn(0).setMaxWidth(55);
    presentAttTable.setShowHorizontalLines(false);
    presentAttTable.setShowVerticalLines(true);
    presentAttTable.setShowGrid(true);
    presentAttTable.addMouseListener(new MouseListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                ActionRegistry.getInstance().get(EditAttFromProtAction.class.getName()).actionPerformed(null);
            }
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }
    });

    TableCellRenderer renderer = (table, value, isSelected, hasFocus, row, column) -> {
        JLabel label = new JLabel((String) value);
        label.setOpaque(true);
        label.setBorder(new EmptyBorder(5, 5, 5, 5));

        label.setFont(UI.VERY_LARGE_FONT);

        if (isSelected) {
            label.setBackground(presentAttTable.getSelectionBackground());
        } else {
            if (row % 2 == 0) {
                label.setBackground(UI.TABLE_ALT_COLOR);
            } else {
                label.setBackground(presentAttTable.getBackground());
            }
        }
        return label;
    };

    for (int i = 1; i <= 4; i++) {
        presentAttTable.getColumnModel().getColumn(i).setCellRenderer(renderer);
    }

    TableColumn col = presentAttTable.getColumnModel().getColumn(0);
    col.setCellRenderer((table, value, isSelected, hasFocus, row, column) -> {
        JPanel localPnl = new JPanel();
        localPnl.add(new JLabel(Data.getInstance().getIcon("attendee_40x40.png")));
        if (isSelected) {
            localPnl.setBackground(presentAttTable.getSelectionBackground());
        } else {
            if (row % 2 == 0) {
                localPnl.setBackground(UI.TABLE_ALT_COLOR);
            } else {
                localPnl.setBackground(presentAttTable.getBackground());
            }
        }
        return localPnl;
    });
    presentAttTable.addMouseListener(new MouseListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            updateAttButtons();
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }
    });

    scrllP = GUITools.setIntoScrollPane(presentAttTable);
    scrllP.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    scrllP.setToolTipText(translate("Add Attendee to Meeting"));
    scrllP.addMouseListener(new MouseListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (isAddResiAttPossible()) {
                ActionRegistry.getInstance().get(AddResiAttToProtAction.class.getName()).actionPerformed(null);
            } else {
                ActionRegistry.getInstance().get(AddAttToProtAction.class.getName()).actionPerformed(null);
            }
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }
    });

    JLabel labelAttendees = new JLabel(translate("Attendees of the current meeting:"));
    labelAttendees.setFont(UI.HUGE_FONT_BOLD);

    GUITools.addComponent(attPanel, gbl, labelAttendees, 0, 0, 2, 1, 1.0, 0.0, 20, 20, 0, 20,
            GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(attPanel, gbl, scrllP, 0, 1, 1, 1, 1.0, 1.0, 20, 20, 0, 20, GridBagConstraints.BOTH,
            GridBagConstraints.NORTHWEST);
    GUITools.addComponent(attPanel, gbl, attendeeButtons, 1, 1, 1, 1, 0, 0, 20, 0, 20, 20,
            GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
}

From source file:us.paulevans.basicxslt.BasicXSLTFrame.java

/**
 * Rebuilds the XSL panel; first it removes all of the components; and then
 * it loops over the xslRows object and re-adds the components.
 *
 *///ww w  . j av  a  2s.co m
private void rebuildXSLPanel() {

    int loop, size;
    int col, xslPanelRow;
    JTextField xslTf;
    JButton browseXslBtn, insertBtn;
    JComboBox action;
    JLabel xslLabel, indicatorLabel;
    JCheckBox removeCb;
    XSLRow xslRow;

    xslPanel.removeAll();
    xslPanelRow = 0;
    GUIUtils.add(xslPanel, new JLabel(""), xslPanelLayout, xslPanelConstraints, xslPanelRow, col = 0, 1, 1,
            GridBagConstraints.EAST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(xslPanel,
            new JLabel(stringFactory.getString(LabelStringFactory.MAIN_FRAME_XML_FILE_WITH_COLON)),
            xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1, GridBagConstraints.EAST,
            GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(xslPanel, sourceXmlTf, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
            GridBagConstraints.WEST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(xslPanel, new JLabel(""), xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
            GridBagConstraints.WEST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(xslPanel, browseXmlBtn, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
            GridBagConstraints.EAST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(xslPanel, xmlAction, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
            GridBagConstraints.EAST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(xslPanel, xmlIndicatorLabel, xslPanelLayout, xslPanelConstraints, xslPanelRow++, ++col, 1, 1,
            GridBagConstraints.WEST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    size = xslRows.size();
    for (loop = 0; loop < size; loop++) {
        xslRow = xslRows.get(loop);
        xslLabel = xslRow.getLabel();
        xslTf = xslRow.getTextField();
        removeCb = xslRow.getRemoveCb();
        browseXslBtn = xslRow.getBrowseBtn();
        insertBtn = xslRow.getInsertBtn();
        indicatorLabel = xslRow.getIndicatorLabel();
        action = xslRow.getAction();
        GUIUtils.add(xslPanel, insertBtn, xslPanelLayout, xslPanelConstraints, xslPanelRow, col = 0, 1, 1,
                GridBagConstraints.EAST, GridBagConstraints.EAST, GUIUtils.NO_INSETS);
        GUIUtils.add(xslPanel, xslLabel, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
                GridBagConstraints.EAST, GridBagConstraints.NONE, GUIUtils.SMALL_INSETS);
        GUIUtils.add(xslPanel, xslTf, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
                GridBagConstraints.WEST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
        GUIUtils.add(xslPanel, removeCb, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
                GridBagConstraints.EAST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
        GUIUtils.add(xslPanel, browseXslBtn, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
                GridBagConstraints.EAST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
        GUIUtils.add(xslPanel, action, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
                GridBagConstraints.EAST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
        GUIUtils.add(xslPanel, indicatorLabel, xslPanelLayout, xslPanelConstraints, xslPanelRow++, ++col, 1, 1,
                GridBagConstraints.EAST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    }
}

From source file:org.revager.gui.findings_list.FindingsListFrame.java

private void createImpPanel() {
    JLabel impLbl = new JLabel(translate("General impression of the product:"));
    impLbl.setFont(UI.VERY_LARGE_FONT_BOLD);

    impTxtArea = new JTextArea();
    impTxtArea.setFont(UI.VERY_LARGE_FONT);

    impTxtArea.addKeyListener(updateListener);
    impTxtArea.addKeyListener(tabKeyListener);

    impTxtArea.setText(revMgmt.getImpression().trim());

    impScrllPn = GUITools.setIntoScrllPn(impTxtArea);
    GUITools.scrollToTop(impScrllPn);/*from   w  w  w  .  ja  v  a 2  s. c o  m*/

    GUITools.addComponent(tabGenImp, gbl, impLbl, 0, 1, 2, 1, 0, 0, 20, 10, 0, 10, GridBagConstraints.NONE,
            GridBagConstraints.NORTHWEST);

    GUITools.addComponent(tabGenImp, gbl, impScrllPn, 0, 2, 2, 1, 1.0, 1.0, 5, 10, 0, 10,
            GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

    tabGenImp.setBorder(new EmptyBorder(0, 10, 20, 10));
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java

/**
 * Lays out the passed components./*from   ww  w .j a v a2  s  .  com*/
 * 
 * @param pane The main pane.
 * @param components The components to lay out.
 */
private void layoutComponents(JPanel pane, Map<JLabel, JComponent> components) {
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 2, 2, 0);
    Entry<JLabel, JComponent> entry;

    Iterator<Entry<JLabel, JComponent>> i = components.entrySet().iterator();
    c.gridy = 0;
    while (i.hasNext()) {
        c.gridx = 0;
        entry = i.next();
        ++c.gridy;
        c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
        c.fill = GridBagConstraints.NONE; //reset to default
        c.weightx = 0.0;
        pane.add(entry.getKey(), c);
        c.gridx++;
        pane.add(Box.createHorizontalStrut(5), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;//end row
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1.0;
        pane.add(entry.getValue(), c);
    }
}

From source file:shuffle.fwk.service.teams.EditTeamService.java

private Component makeBottomPanel() {
    JPanel ret = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.weightx = 1.0;/*from  w ww.ja v  a  2  s . com*/
    c.weighty = 0.0;
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = 1;
    c.gridheight = 1;

    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0.0;
    c.gridx += 1;
    c.insets = new Insets(0, 10, 0, 10);
    selectedDisplayLabel = new JLabel(getString(KEY_NONE_SELECTED));
    selectedDisplayLabel.setToolTipText(getString(KEY_SELECTED_TOOLTIP));
    ret.add(selectedDisplayLabel, c);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 1.0;
    c.gridx++;
    survivalMode = new JCheckBox(getString(KEY_SURVIVAL));
    JPanel survivalModePanel = new JPanel(new BorderLayout());
    survivalModePanel.add(survivalMode, BorderLayout.WEST);
    survivalMode.setToolTipText(getString(KEY_SURVIVAL_TOOLTIP));
    ret.add(survivalModePanel, c);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.0;
    c.gridx += 1;
    JButton okButton = new JButton(getString(KEY_OK));
    okButton.setToolTipText(getString(KEY_OK_TOOLTIP));
    ret.add(okButton, c);
    setDefaultButton(okButton);

    c.anchor = GridBagConstraints.CENTER;
    c.weightx = 0.0;
    c.gridx += 1;
    JButton applyButton = new JButton(getString(KEY_APPLY));
    applyButton.setToolTipText(getString(KEY_APPLY_TOOLTIP));
    ret.add(applyButton, c);

    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0.0;
    c.gridx += 1;
    JButton cancelButton = new JButton(new DisposeAction(getString(KEY_CANCEL), this));
    cancelButton.setToolTipText(getString(KEY_CANCEL_TOOLTIP));
    ret.add(cancelButton, c);

    okButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            onOK();
        }
    });
    applyButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            onApply();
        }
    });
    return ret;
}

From source file:org.dwfa.ace.classifier.CNFormsLabelPanel.java

public void setConcept(I_GetConceptData conceptIn, I_ConfigAceFrame config)
        throws IOException, TerminologyException {
    this.theCBean = conceptIn;
    this.config = config;

    commonJPanel.removeAll();//from   w  w w .j  ava2s  . c  om
    deltaJPanel.removeAll();
    formsJPanel.removeAll(); // FORMS HAS SUBPANELS: STATED & COMPUTED

    if (conceptIn == null)
        return;

    // COMMON & DIFFERENT SECTION
    // COMMON PANEL
    commonLabels = getCommonLabels(showDetailCB.isSelected(), showStatusCB.isSelected(), config); // ####
    commonPartJPanel = new JPanel();
    setMinMaxSize(commonPartJPanel);
    commonPartJPanel.setLayout(new BoxLayout(commonPartJPanel, BoxLayout.Y_AXIS));
    for (I_ImplementActiveLabel l : commonLabels) {
        commonPartJPanel.add(l.getLabel());
    }

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.gridheight = 1;
    c.gridwidth = 1;
    c.weightx = 0;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 0;
    commonJPanel.add(commonPartJPanel, c);

    // DELTA (DIFFERENCES) PANEL
    Map<I_ConceptAttributeTuple, Color> conAttrColorMap = new HashMap<I_ConceptAttributeTuple, Color>();
    Map<I_DescriptionTuple, Color> desColorMap = new HashMap<I_DescriptionTuple, Color>();
    Map<I_RelTuple, Color> relColorMap = new HashMap<I_RelTuple, Color>();
    colors.reset();
    Collection<I_ImplementActiveLabel> deltaLabels = getDeltaLabels(showDetailCB.isSelected(),
            showStatusCB.isSelected(), config, colors, conAttrColorMap, desColorMap, relColorMap); // ####
    deltaPartJPanel = new JPanel();
    deltaPartJPanel.setLayout(new BoxLayout(deltaPartJPanel, BoxLayout.Y_AXIS));
    for (I_ImplementActiveLabel l : deltaLabels) {
        deltaPartJPanel.add(l.getLabel());
    }
    deltaJPanel.add(deltaPartJPanel);

    // FORM STATED PANEL
    c = new GridBagConstraints();
    c.fill = GridBagConstraints.VERTICAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.weightx = 0; // horizontal free space distribution weight
    c.weighty = 0; // vertical free space distribution weight
    c.gridx = 0;
    c.gridy = 0;

    JPanel tmpJPanel;
    tmpJPanel = newFormStatedJPanel("Stated Form:", config, conAttrColorMap, desColorMap, relColorMap); // ####
    setMinMaxSize(tmpJPanel);
    formsJPanel.add(tmpJPanel, c);

    // FORM DISTRIBUTION NORMAL PANEL
    if (showDistFormCB.isSelected()) {
        c.gridx++;
        if (c.gridx == 2) {
            c.gridx = 0;
            c.gridy++;
        }
        tmpJPanel = newFormDistJPanel("Distribution Normal Form:", config, conAttrColorMap, desColorMap,
                relColorMap); // ####
        setMinMaxSize(tmpJPanel);
        formsJPanel.add(tmpJPanel, c);
    }

    // AUTHORING NORMAL FORM PANEL
    if (showAuthFormCB.isSelected()) {
        c.gridx++;
        if (c.gridx == 2) {
            c.gridx = 0;
            c.gridy++;
        }
        tmpJPanel = newFormAuthJPanel("Authoring Normal Form:", config, conAttrColorMap, desColorMap,
                relColorMap); // ####
        setMinMaxSize(tmpJPanel);
        formsJPanel.add(tmpJPanel, c);
    }

    // LONG CANONICAL FORM PANEL
    if (showLongFormCB.isSelected()) {
        c.gridx++;
        if (c.gridx == 2) {
            c.gridx = 0;
            c.gridy++;
        }
        tmpJPanel = newFormLongJPanel("Long Canonical Form:", config, conAttrColorMap, desColorMap,
                relColorMap); // ####
        setMinMaxSize(tmpJPanel);
        formsJPanel.add(tmpJPanel, c);
    }

    // FORM SHORT CANONICAL PANEL
    if (showShortFormCB.isSelected()) {
        c.gridx++;
        if (c.gridx == 2) {
            c.gridx = 0;
            c.gridy++;
        }
        tmpJPanel = newFormShortJPanel("Short Canonical Form:", config, conAttrColorMap, desColorMap,
                relColorMap); // ####
        setMinMaxSize(tmpJPanel);
        formsJPanel.add(tmpJPanel, c);
    }
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java

private void addConfigurationLineItem() {
    JLabel jobConfigurationLabel = new JLabel("Job configurations");

    add(jobConfigurationLabel, new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 1, 0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0));

    String[] columns = { "Key", "Value", "" };

    jobConfigurationTable = new JBTable();
    Dimension jobConfigurationTableSize = new Dimension(320, 100);
    jobConfigurationTable.setPreferredScrollableViewportSize(jobConfigurationTableSize);

    jobConfigurationTable.setSurrendersFocusOnKeystroke(true);
    jobConfigurationTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    jobConfigurationTable.setColumnSelectionAllowed(true);
    JBScrollPane scrollPane = new JBScrollPane(jobConfigurationTable);
    jobConfigurationTable.setFillsViewportHeight(true);
    scrollPane.setMinimumSize(jobConfigurationTableSize);

    jobConfigurationTable.addPropertyChangeListener((evt) -> {
        if ((evt.getPropertyName().equals("tableCellEditor") || evt.getPropertyName().equals("model"))
                && jobConfigurationTable.getModel() instanceof SubmissionTableModel) {
            SubmissionTableModel model = (SubmissionTableModel) jobConfigurationTable.getModel();
            setVisibleForFixedErrorMessageLabel(ErrorMessageLabelTag.JobConfiguration.ordinal(), false);

            SparkSubmissionJobConfigCheckResult result = model.getFirstCheckResults();
            if (result != null) {
                setStatusForMessageLabel(ErrorMessageLabelTag.JobConfiguration.ordinal(), true,
                        result.getMessaqge(),
                        result.getStatus() == SparkSubmissionJobConfigCheckStatus.Warning);
            }// w ww .  j av a2 s . co m
        }
    });

    add(scrollPane, new GridBagConstraints(1, displayLayoutCurrentRow, 1, 1, 1, 0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, 0), 0, 0));

    JButton loadJobConfigurationButton = new JButton("...");
    loadJobConfigurationButton.setPreferredSize(selectedArtifactTextField.getButton().getPreferredSize());
    FixedSizeButton loadJobConfigurationFixedSizeButton = new FixedSizeButton(loadJobConfigurationButton);

    add(loadJobConfigurationFixedSizeButton,
            new GridBagConstraints(2, displayLayoutCurrentRow, 0, 1, 0, 0, GridBagConstraints.NORTHEAST,
                    GridBagConstraints.NONE, new Insets(margin, margin / 2, 0, margin), 0, 0));
    loadJobConfigurationFixedSizeButton.setToolTipText("Load Spark config from property file");

    loadJobConfigurationFixedSizeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false,
                    false, false);

            fileChooserDescriptor.setTitle("Select Spark property file");

            VirtualFile chooseFile = FileChooser.chooseFile(fileChooserDescriptor, null, null);
            if (chooseFile != null) {
                submitModel.loadJobConfigMapFromPropertyFile(chooseFile.getCanonicalPath());
            }
        }
    });

    errorMessageLabels[ErrorMessageLabelTag.JobConfiguration.ordinal()] = new JLabel();
    errorMessageLabels[ErrorMessageLabelTag.JobConfiguration.ordinal()]
            .setForeground(DarkThemeManager.getInstance().getErrorMessageColor());
    errorMessageLabels[ErrorMessageLabelTag.JobConfiguration.ordinal()].setVisible(false);

    add(errorMessageLabels[ErrorMessageLabelTag.JobConfiguration.ordinal()],
            new GridBagConstraints(1, ++displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.NORTHWEST,
                    GridBagConstraints.HORIZONTAL, new Insets(0, margin, 0, margin), 0, 0));

}

From source file:com.sec.ose.osi.ui.frm.main.identification.codematch.JPanCodeMatchMain.java

/**
 * This method initializes jPanel2   //from  w w w .jav a2 s.  c o  m
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelViewBtn() {
    if (jPanelViewBtn == null) {
        GridBagConstraints gridBagConstraints18 = new GridBagConstraints();
        gridBagConstraints18.gridx = 1;
        gridBagConstraints18.anchor = GridBagConstraints.EAST;
        gridBagConstraints18.fill = GridBagConstraints.NONE;
        gridBagConstraints18.insets = new Insets(0, 0, 10, 10);
        gridBagConstraints18.weightx = 1.0;
        GridBagConstraints gridBagConstraints16 = new GridBagConstraints();
        gridBagConstraints16.gridx = 0;
        gridBagConstraints16.weightx = 1.0;
        gridBagConstraints16.anchor = GridBagConstraints.WEST;
        gridBagConstraints16.insets = new Insets(0, 10, 0, 0);
        gridBagConstraints16.gridy = 0;
        jLabelStringSearchIdentifyInfo = new JLabel();
        jLabelStringSearchIdentifyInfo
                .setText("This file is identified as (StringSearchLicense) by String Search");
        jPanelViewBtn = new JPanel();
        jPanelViewBtn.setLayout(new GridBagLayout());
        jPanelViewBtn.add(getJButtonView(), gridBagConstraints18);
        jPanelViewBtn.add(jLabelStringSearchIdentifyInfo, gridBagConstraints16);
    }
    return jPanelViewBtn;
}

From source file:net.technicpack.launcher.ui.InstallerFrame.java

private void setupPortableMode(JPanel panel) {
    panel.setLayout(new GridBagLayout());

    JLabel portableSpiel = new JLabel("<html><body align=\"left\" style='margin-right:10px;'>"
            + resources.getString("launcher.installer.portablespiel") + "</body></html>");
    portableSpiel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    portableSpiel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    portableSpiel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.add(portableSpiel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(9, 8, 9, 3), 0, 0));

    panel.add(Box.createGlue(), new GridBagConstraints(0, 1, 3, 1, 1.0, 0.7, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    JLabel installFolderLabel = new JLabel(resources.getString("launcher.installer.folder"));
    installFolderLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18));
    installFolderLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(installFolderLabel, new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(0, 24, 0, 8), 0, 0));

    String installDir = "";
    if (settings.isPortable())
        installDir = settings.getTechnicRoot().getAbsolutePath();

    portableInstallDir = new JTextField(installDir);
    portableInstallDir.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18));
    portableInstallDir.setForeground(LauncherFrame.COLOR_BLUE);
    portableInstallDir.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    portableInstallDir.setHighlighter(null);
    portableInstallDir.setEditable(false);
    portableInstallDir.setCursor(null);/*from  www . j ava2  s  .  c om*/
    portableInstallDir.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 8));
    panel.add(portableInstallDir, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0));

    RoundedButton selectInstall = new RoundedButton(resources.getString("launcher.installer.select"));
    selectInstall.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18));
    selectInstall.setContentAreaFilled(false);
    selectInstall.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    selectInstall.setHoverForeground(LauncherFrame.COLOR_BLUE);
    selectInstall.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            selectPortable();
        }
    });
    panel.add(selectInstall, new GridBagConstraints(2, 2, 1, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 0, 16), 0, 0));

    panel.add(Box.createGlue(), new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    String defaultLocaleText = resources.getString("launcheroptions.language.default");
    if (!resources.isDefaultLocaleSupported()) {
        defaultLocaleText = defaultLocaleText
                .concat(" (" + resources.getString("launcheroptions.language.unavailable") + ")");
    }

    portableLanguages = new JComboBox();
    portableLanguages.addItem(new LanguageItem(ResourceLoader.DEFAULT_LOCALE, defaultLocaleText, resources));
    for (int i = 0; i < ResourceLoader.SUPPORTED_LOCALES.length; i++) {
        portableLanguages
                .addItem(new LanguageItem(resources.getCodeFromLocale(ResourceLoader.SUPPORTED_LOCALES[i]),
                        ResourceLoader.SUPPORTED_LOCALES[i].getDisplayName(ResourceLoader.SUPPORTED_LOCALES[i]),
                        resources.getVariant(ResourceLoader.SUPPORTED_LOCALES[i])));
    }
    if (!settings.getLanguageCode().equalsIgnoreCase(ResourceLoader.DEFAULT_LOCALE)) {
        Locale loc = resources.getLocaleFromCode(settings.getLanguageCode());

        for (int i = 0; i < ResourceLoader.SUPPORTED_LOCALES.length; i++) {
            if (loc.equals(ResourceLoader.SUPPORTED_LOCALES[i])) {
                portableLanguages.setSelectedIndex(i + 1);
                break;
            }
        }
    }
    portableLanguages.setBorder(new RoundBorder(LauncherFrame.COLOR_SCROLL_THUMB, 1, 10));
    portableLanguages.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14));
    portableLanguages.setUI(new LanguageCellUI(resources));
    portableLanguages.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    portableLanguages.setBackground(LauncherFrame.COLOR_SELECTOR_BACK);
    portableLanguages.setRenderer(new LanguageCellRenderer(resources, "globe.png",
            LauncherFrame.COLOR_SELECTOR_BACK, LauncherFrame.COLOR_WHITE_TEXT));
    portableLanguages.setEditable(false);
    portableLanguages.setFocusable(false);
    portableLanguages.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            portableLanguageChanged();
        }
    });
    panel.add(portableLanguages, new GridBagConstraints(0, 4, 1, 0, 0, 0, GridBagConstraints.SOUTHWEST,
            GridBagConstraints.NONE, new Insets(0, 8, 8, 0), 0, 0));

    portableInstallButton = new RoundedButton(resources.getString("launcher.installer.install"));
    portableInstallButton.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18));
    portableInstallButton.setContentAreaFilled(false);
    portableInstallButton.setForeground(LauncherFrame.COLOR_GREY_TEXT);
    portableInstallButton.setHoverForeground(LauncherFrame.COLOR_BLUE);
    portableInstallButton.setBorder(BorderFactory.createEmptyBorder(8, 56, 8, 56));
    portableInstallButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            portableInstall();
        }
    });
    portableInstallButton.setEnabled(false);

    if (!installDir.equals("")) {
        portableInstallButton.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
        portableInstallButton.setEnabled(true);
    }

    panel.add(portableInstallButton, new GridBagConstraints(1, 4, 2, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.VERTICAL, new Insets(0, 0, 8, 8), 0, 0));
}