Search in sources :

Example 21 with Dimension

use of java.awt.Dimension in project hackpad by dropbox.

the class RunProxy method enterInterruptImpl.

/**
     * Handles script interruption.
     */
void enterInterruptImpl(Dim.StackFrame lastFrame, String threadTitle, String alertMessage) {
    statusBar.setText("Thread: " + threadTitle);
    showStopLine(lastFrame);
    if (alertMessage != null) {
        MessageDialogWrapper.showMessageDialog(this, alertMessage, "Exception in Script", JOptionPane.ERROR_MESSAGE);
    }
    updateEnabled(true);
    Dim.ContextData contextData = lastFrame.contextData();
    JComboBox ctx = context.context;
    List<String> toolTips = context.toolTips;
    context.disableUpdate();
    int frameCount = contextData.frameCount();
    ctx.removeAllItems();
    // workaround for JDK 1.4 bug that caches selected value even after
    // removeAllItems() is called
    ctx.setSelectedItem(null);
    toolTips.clear();
    for (int i = 0; i < frameCount; i++) {
        Dim.StackFrame frame = contextData.getFrame(i);
        String url = frame.getUrl();
        int lineNumber = frame.getLineNumber();
        String shortName = url;
        if (url.length() > 20) {
            shortName = "..." + url.substring(url.length() - 17);
        }
        String location = "\"" + shortName + "\", line " + lineNumber;
        ctx.insertItemAt(location, i);
        location = "\"" + url + "\", line " + lineNumber;
        toolTips.add(location);
    }
    context.enableUpdate();
    ctx.setSelectedIndex(0);
    ctx.setMinimumSize(new Dimension(50, ctx.getMinimumSize().height));
}
Also used : Dimension(java.awt.Dimension) Point(java.awt.Point)

Example 22 with Dimension

use of java.awt.Dimension in project pcgen by PCGen.

the class TableUtils method createToggleButtonSelectionPane.

private static JScrollPane createToggleButtonSelectionPane(JTable table, JTable rowheaderTable, JToggleButton button) {
    rowheaderTable.setAutoCreateColumnsFromModel(false);
    // force the tables to share models
    rowheaderTable.setModel(table.getModel());
    rowheaderTable.setSelectionModel(table.getSelectionModel());
    rowheaderTable.setRowHeight(table.getRowHeight());
    rowheaderTable.setIntercellSpacing(table.getIntercellSpacing());
    rowheaderTable.setShowGrid(false);
    rowheaderTable.setFocusable(false);
    TableColumn column = new TableColumn(-1);
    column.setHeaderValue(new Object());
    column.setCellRenderer(new TableCellUtilities.ToggleButtonRenderer(button));
    rowheaderTable.addColumn(column);
    rowheaderTable.setPreferredScrollableViewportSize(new Dimension(20, 0));
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setViewportView(table);
    scrollPane.setRowHeaderView(rowheaderTable);
    return scrollPane;
}
Also used : JScrollPane(javax.swing.JScrollPane) Dimension(java.awt.Dimension) TableColumn(javax.swing.table.TableColumn)

Example 23 with Dimension

use of java.awt.Dimension in project pcgen by PCGen.

the class InfoGuidePane method initComponents.

private void initComponents() {
    mainPanel = new JPanel();
    mainPanel.setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION, null));
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    mainPanel.setPreferredSize(new Dimension(650, 450));
    setOpaque(false);
    JPanel sourcesPanel = new JPanel(new GridBagLayout());
    GridBagConstraints gbc1 = new GridBagConstraints();
    gbc1.anchor = GridBagConstraints.EAST;
    GridBagConstraints gbc2 = new GridBagConstraints();
    gbc2.gridwidth = GridBagConstraints.REMAINDER;
    gbc2.fill = GridBagConstraints.BOTH;
    sourcesPanel.add(new JLabel(LanguageBundle.getString("in_si_intro")), gbc2);
    sourcesPanel.add(new JLabel(LanguageBundle.getString("in_si_gamemode")), gbc1);
    sourcesPanel.add(gameModeLabel, gbc2);
    sourcesPanel.add(new JLabel(LanguageBundle.getString("in_si_sources")), gbc1);
    sourcesPanel.add(campaignList, gbc2);
    JEditorPane guidePane = createHtmlPane();
    guidePane.setText(LanguageBundle.getFormattedString("in_si_whatnext", Icons.New16.getImageIcon(), Icons.Open16.getImageIcon()));
    mainPanel.add(sourcesPanel);
    mainPanel.add(guidePane);
    mainPanel.add(tipPane);
    refreshDisplayedSources(null);
    JPanel outerPanel = new JPanel(new FlowLayout());
    outerPanel.add(mainPanel);
    setLayout(new BorderLayout());
    add(outerPanel, BorderLayout.CENTER);
    tipPane.setText(LanguageBundle.getFormattedString("in_si_tip", TipOfTheDayHandler.getInstance().getNextTip()));
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) BorderLayout(java.awt.BorderLayout) BoxLayout(javax.swing.BoxLayout) JEditorPane(javax.swing.JEditorPane) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 24 with Dimension

use of java.awt.Dimension in project pcgen by PCGen.

the class RaceInfoTab method initComponents.

private void initComponents() {
    FlippingSplitPane topPane = new FlippingSplitPane("RaceTop");
    setTopComponent(topPane);
    setOrientation(VERTICAL_SPLIT);
    JPanel availPanel = new JPanel(new BorderLayout());
    FilterBar<Object, RaceFacade> bar = new FilterBar<>();
    bar.addDisplayableFilter(new SearchFilterPanel());
    //$NON-NLS-1$
    noRacialHdFilterButton.setText(LanguageBundle.getString("in_irNoRacialHd"));
    //$NON-NLS-1$
    noRacialHdFilterButton.setToolTipText(LanguageBundle.getString("in_irNoRacialHdTip"));
    bar.addDisplayableFilter(noRacialHdFilterButton);
    //$NON-NLS-1$
    qFilterButton.setText(LanguageBundle.getString("in_igQualFilter"));
    bar.addDisplayableFilter(qFilterButton);
    raceTable.setDisplayableFilter(bar);
    availPanel.add(bar, BorderLayout.NORTH);
    raceTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    raceTable.setTreeCellRenderer(qualifiedRenderer);
    availPanel.add(new JScrollPane(raceTable), BorderLayout.CENTER);
    Box box = Box.createHorizontalBox();
    box.add(Box.createHorizontalGlue());
    selectRaceButton.setHorizontalTextPosition(SwingConstants.LEADING);
    box.add(selectRaceButton);
    box.add(Box.createHorizontalStrut(5));
    box.setBorder(new EmptyBorder(0, 0, 5, 0));
    availPanel.add(box, BorderLayout.SOUTH);
    topPane.setLeftComponent(availPanel);
    JPanel selPanel = new JPanel(new BorderLayout());
    FilterBar<Object, RaceFacade> filterBar = new FilterBar<>();
    filterBar.addDisplayableFilter(new SearchFilterPanel());
    selectedTable.setDisplayableFilter(filterBar);
    selectedTable.setTreeCellRenderer(qualifiedRenderer);
    JScrollPane scrollPane = new JScrollPane(selectedTable);
    selPanel.add(scrollPane, BorderLayout.CENTER);
    scrollPane.setPreferredSize(new Dimension(0, 0));
    box = Box.createHorizontalBox();
    box.add(Box.createHorizontalStrut(5));
    box.add(removeButton);
    box.add(Box.createHorizontalGlue());
    box.setBorder(new EmptyBorder(0, 0, 5, 0));
    selPanel.add(box, BorderLayout.SOUTH);
    topPane.setRightComponent(selPanel);
    topPane.setResizeWeight(0.75);
    setBottomComponent(infoPane);
    setResizeWeight(0.75);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FilterBar(pcgen.gui2.filter.FilterBar) BorderLayout(java.awt.BorderLayout) Box(javax.swing.Box) SearchFilterPanel(pcgen.gui2.filter.SearchFilterPanel) Dimension(java.awt.Dimension) EmptyBorder(javax.swing.border.EmptyBorder) FlippingSplitPane(pcgen.gui2.tools.FlippingSplitPane) RaceFacade(pcgen.facade.core.RaceFacade)

Example 25 with Dimension

use of java.awt.Dimension in project pcgen by PCGen.

the class SkillInfoTab method initComponents.

private void initComponents() {
    setOrientation(VERTICAL_SPLIT);
    setResizeWeight(0.70);
    JSpinner spinner = new JSpinner();
    //$NON-NLS-1$
    spinner.setEditor(new JSpinner.NumberEditor(spinner, "#0.#"));
    skillTable.setDefaultRenderer(Float.class, new SpinnerRenderer(spinner));
    skillTable.setDefaultRenderer(Integer.class, new TableCellUtilities.AlignRenderer(SwingConstants.CENTER));
    skillTable.setDefaultRenderer(String.class, new TableCellUtilities.AlignRenderer(SwingConstants.CENTER));
    skillTable.setRowHeight(26);
    FilterBar<CharacterFacade, SkillFacade> filterBar = new FilterBar<>();
    filterBar.addDisplayableFilter(new SearchFilterPanel());
    //$NON-NLS-1$
    cFilterButton.setText(LanguageBundle.getString("in_classString"));
    cFilterButton.setEnabled(false);
    filterBar.addDisplayableFilter(cFilterButton);
    //$NON-NLS-1$
    trainedFilterButton.setText(LanguageBundle.getString("in_trained"));
    trainedFilterButton.setEnabled(false);
    filterBar.addDisplayableFilter(trainedFilterButton);
    JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(skillTable, filterBar);
    availPanel.setPreferredSize(new Dimension(650, 300));
    JScrollPane tableScrollPane;
    JPanel tablePanel = new JPanel(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    constraints.fill = java.awt.GridBagConstraints.BOTH;
    constraints.weightx = 1.0;
    constraints.ipady = 0;
    constraints.weighty = 1.0;
    SkillPointTableModel.initializeTable(skillpointTable);
    tableScrollPane = new JScrollPane(skillpointTable);
    tablePanel.add(tableScrollPane, constraints);
    htmlPane.setOpaque(false);
    htmlPane.setEditable(false);
    htmlPane.setFocusable(false);
    //$NON-NLS-1$
    htmlPane.setContentType("text/html");
    skillFilterBox.setRenderer(new DefaultListCellRenderer());
    JScrollPane selScrollPane = new JScrollPane(htmlPane);
    JPanel skillPanel = new JPanel(new BorderLayout());
    skillPanel.add(skillFilterBox, BorderLayout.NORTH);
    skillPanel.add(selScrollPane, BorderLayout.CENTER);
    selScrollPane.setPreferredSize(new Dimension(530, 300));
    FlippingSplitPane topPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, availPanel, skillPanel, "SkillTop");
    setTopComponent(topPane);
    FlippingSplitPane bottomPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, "SkillBottom");
    bottomPane.setLeftComponent(tablePanel);
    tablePanel.setPreferredSize(new Dimension(650, 100));
    bottomPane.setRightComponent(infoPane);
    infoPane.setPreferredSize(new Dimension(530, 100));
    setBottomComponent(bottomPane);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) SkillFacade(pcgen.facade.core.SkillFacade) Dimension(java.awt.Dimension) SpinnerRenderer(pcgen.gui2.util.table.TableCellUtilities.SpinnerRenderer) CharacterFacade(pcgen.facade.core.CharacterFacade) FlippingSplitPane(pcgen.gui2.tools.FlippingSplitPane) TableCellUtilities(pcgen.gui2.util.table.TableCellUtilities) FilterBar(pcgen.gui2.filter.FilterBar) BorderLayout(java.awt.BorderLayout) DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) JSpinner(javax.swing.JSpinner) SearchFilterPanel(pcgen.gui2.filter.SearchFilterPanel)

Aggregations

Dimension (java.awt.Dimension)3966 JPanel (javax.swing.JPanel)1083 JLabel (javax.swing.JLabel)737 Point (java.awt.Point)676 JButton (javax.swing.JButton)667 ActionEvent (java.awt.event.ActionEvent)642 ActionListener (java.awt.event.ActionListener)581 JScrollPane (javax.swing.JScrollPane)554 BorderLayout (java.awt.BorderLayout)490 Insets (java.awt.Insets)403 BoxLayout (javax.swing.BoxLayout)333 GridBagLayout (java.awt.GridBagLayout)308 GridBagConstraints (java.awt.GridBagConstraints)262 FlowLayout (java.awt.FlowLayout)240 JTextField (javax.swing.JTextField)231 ImageIcon (javax.swing.ImageIcon)216 Component (java.awt.Component)214 Color (java.awt.Color)202 ChangeEvent (javax.swing.event.ChangeEvent)200 ChangeListener (javax.swing.event.ChangeListener)198