Java Code Examples for javax.swing.JTabbedPane#addTab()

The following examples show how to use javax.swing.JTabbedPane#addTab() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditTransactionsDialog.java    From javamoney-examples with Apache License 2.0 6 votes vote down vote up
private Panel createEditPanel() {
	Panel panel = new Panel();
	JTabbedPane tabs = new JTabbedPane();

	// Build tabs.
	if (getLists().get(EXPENSES).size() != 0) {
		tabs.addTab(getSharedProperty("expenses"),
				createTypePanel(EXPENSES));
	}

	if (getLists().get(INCOME).size() != 0) {
		tabs.addTab(getSharedProperty("income"), createTypePanel(INCOME));
	}

	if (getLists().get(TRANSFERS).size() != 0) {
		tabs.addTab(getSharedProperty("transfers"), createTransferPanel());
	}

	// Build panel.
	panel.setFill(GridBagConstraints.BOTH);
	panel.add(tabs, 0, 0, 1, 1, 100, 100);

	panel.setInsets(new Insets(5, 5, 0, 5));

	return panel;
}
 
Example 2
Source File: FrontEnd.java    From microrts with GNU General Public License v3.0 6 votes vote down vote up
public FrontEnd() throws Exception {
    super(new GridLayout(1, 1));
     
    JTabbedPane tabbedPane = new JTabbedPane();
     
    FEStatePane panel1 = new FEStatePane();
    tabbedPane.addTab("States", null, panel1, "Load/save states and play games.");
     
    JComponent panel2 = new FETracePane(panel1);
    tabbedPane.addTab("Traces", null, panel2, "Load/save and view replays.");
    
    JComponent panel3 = new FETournamentPane();
    tabbedPane.addTab("Tournaments", null, panel3, "Run tournaments.");

    //Add the tabbed pane to this panel.
    add(tabbedPane);
     
    //The following line enables to use scrolling tabs.
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);   
}
 
Example 3
Source File: PropertiesDialog.java    From collect-earth with MIT License 6 votes vote down vote up
private JTabbedPane getOptionTabs() {
	final JTabbedPane tabbedPane = new JTabbedPane();
	tabbedPane.setSize(550, 300);
	final JComponent panel1 = getSampleDataPanel();
	tabbedPane.addTab(Messages.getString("OptionWizard.31"), panel1); //$NON-NLS-1$

	final JComponent panel2 = getPlotOptionsPanel();
	tabbedPane.addTab(Messages.getString("OptionWizard.32"), panel2); //$NON-NLS-1$

	final JComponent panel3 = getSurveyDefinitonPanel();
	tabbedPane.addTab(Messages.getString("OptionWizard.33"), panel3); //$NON-NLS-1$

	final JComponent panel41 = getIntegrationsPanel();
	tabbedPane.addTab(Messages.getString("OptionWizard.34"), panel41); //$NON-NLS-1$

	final JComponent panel4 = getBrowsersOptionsPanel();
	tabbedPane.addTab(Messages.getString("OptionWizard.104"), panel4); //$NON-NLS-1$

	final JComponent panel5 = getOperationModePanelScroll();
	tabbedPane.addTab(Messages.getString("OptionWizard.25"), panel5); //$NON-NLS-1$

	final JComponent panel6 = getProjectsPanelScroll();
	tabbedPane.addTab(Messages.getString("OptionWizard.40"), panel6); //$NON-NLS-1$

	return tabbedPane;
}
 
Example 4
Source File: ROC.java    From meka with GNU General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
  if (args.length != 1)
    throw new IllegalArgumentException("Required arguments: <dataset>");

  System.out.println("Loading data: " + args[0]);
  Instances data = DataSource.read(args[0]);
  MLUtils.prepareData(data);

  System.out.println("Cross-validate BR classifier");
  BR classifier = new BR();
  // further configuration of classifier
  String top = "PCut1";
  String vop = "3";
  Result result = Evaluation.cvModel(classifier, data, 10, top, vop);

  JFrame frame = new JFrame("ROC");
  frame.setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE);
  frame.getContentPane().setLayout(new BorderLayout());
  JTabbedPane tabbed = new JTabbedPane();
  frame.getContentPane().add(tabbed, BorderLayout.CENTER);
  Instances[] curves = (Instances[]) result.getMeasurement(CURVE_DATA);
  for (int i = 0; i < curves.length; i++) {
    try {
      ThresholdVisualizePanel panel = createPanel(curves[i], "Label " + i);
      tabbed.addTab("" + i, panel);
    }
    catch (Exception ex) {
      System.err.println("Failed to create plot for label " + i);
      ex.printStackTrace();
    }
  }
  frame.setSize(800, 600);
  frame.setLocationRelativeTo(null);
  frame.setVisible(true);
}
 
Example 5
Source File: Test6943780.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void run() {
    JTabbedPane pane = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
    pane.addTab("first", new JButton("first"));
    pane.addTab("second", new JButton("second"));
    for (Component component : pane.getComponents()) {
        component.setSize(100, 100);
    }
}
 
Example 6
Source File: CourseTabFactory.java    From tmc-intellij with MIT License 5 votes vote down vote up
private void setScrollBarToBottom(String course,
                                  JTabbedPane tabbedPanelBase,
                                  JBScrollPane panel) {

    tabbedPanelBase.addTab(course, panel);
    JScrollBar bar = panel.getVerticalScrollBar();
    AdjustmentListener listener = event -> event.getAdjustable().setValue(event.getAdjustable().getMaximum());

    bar.addAdjustmentListener(listener);
    bar.setValueIsAdjusting(true);
    bar.removeAdjustmentListener(listener);
    bar.setValue(bar.getMaximum());
}
 
Example 7
Source File: bug7170310.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowUI() {
    frame = new JFrame("bug7170310");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200, 100);

    tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Main Tab", new JPanel());

    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

    frame.getContentPane().add(tabbedPane);
    frame.setVisible(true);
}
 
Example 8
Source File: SplitterFrame.java    From ios-image-util with MIT License 5 votes vote down vote up
/**
 * Create SplitterSizePanel as new tab.
 *
 * @param type	device type
 * @param tabs	tabbed pane
 * @param owner
 * @return
 */
protected static SplitterSizePanel newAsTab(final SplitterSizePanel.DEVICE_TYPE type, final JTabbedPane tabs, final MainFrame owner) {
	SplitterSizePanel ssp = new SplitterSizePanel(type, owner);
	tabs.addTab(ssp.getType().toString(), ssp.iconUnchecked, ssp);
	ssp.tabs = tabs;
	ssp.setBackground(tabs.getBackground());
	tabs.setBackgroundAt(tabs.getTabCount() - 1, new Color(0xEEEEEE));
	return ssp;
}
 
Example 9
Source File: FieldConfigInlineFeature.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/** Creates the ui. */
/*
 * (non-Javadoc)
 *
 * @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
 */
@Override
public void createUI() {
    if (inlineGML == null) {

        inlineGML = new InlineGMLPreviewPanel(this, NO_OF_ROWS);
        inlineFeature = new InlineFeaturePanel(this, NO_OF_ROWS);

        tabbedPane = new JTabbedPane(JTabbedPane.TOP);
        tabbedPane.addTab(
                Localisation.getString(
                        FieldConfigBase.class, "FieldConfigInlineFeature.feature"),
                null,
                inlineFeature,
                Localisation.getString(
                        FieldConfigBase.class, "FieldConfigInlineFeature.feature.tooltip"));
        tabbedPane.addTab(
                Localisation.getString(FieldConfigBase.class, "FieldConfigInlineFeature.gml"),
                null,
                inlineGML,
                Localisation.getString(
                        FieldConfigBase.class, "FieldConfigInlineFeature.gml.tooltip"));
        tabbedPane.setBounds(0, 0, inlineGML.getWidth(), inlineGML.getHeight());

        int xPos = getXPos();
        FieldPanel fieldPanel =
                createFieldPanel(xPos, BasePanel.WIDGET_HEIGHT * NO_OF_ROWS, getLabel());
        fieldPanel.add(tabbedPane);
    }
}
 
Example 10
Source File: GltfBrowserPanel.java    From JglTF with MIT License 5 votes vote down vote up
/**
 * Creates a new browser panel for the given {@link GltfModel}
 * 
 * @param gltfModel The {@link GltfModel}
 */
GltfBrowserPanel(GltfModel gltfModel)
{
    super(new BorderLayout());
    
    this.gltfModel = Objects.requireNonNull(
        gltfModel, "The gltfModel may not be null");
    this.selectionPathHistory = new LinkedList<TreePath>();
    this.infoComponentFactory = new InfoComponentFactory(gltfModel);
    
    Object gltf = getGltf(gltfModel);
    this.resolver = new Resolver(gltf);
    
    add(createControlPanel(), BorderLayout.NORTH);
    
    JSplitPane mainSplitPane = new JSplitPane();
    add(mainSplitPane, BorderLayout.CENTER);
    SwingUtilities.invokeLater(new Runnable()
    {
        @Override
        public void run()
        {
            mainSplitPane.setDividerLocation(0.3);
        }
    });
    
    mainSplitPane.setLeftComponent(
        createTreePanel(gltf));
    
    mainTabbedPane = new JTabbedPane();
    mainSplitPane.setRightComponent(mainTabbedPane);
    
    infoPanelContainer = new JPanel(new GridLayout(1,1));
    mainTabbedPane.addTab("Info", infoPanelContainer);
    
    gltfViewerPanel = new GltfViewerPanel(gltfModel);
    mainTabbedPane.addTab("View", gltfViewerPanel);
}
 
Example 11
Source File: ProgramPanel.java    From mpcmaid with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @return A Component that is also BindingCapable
 * 
 *         When we select another pad, call the setElement() method to
 *         update the view
 */
private Component makeFiltersArea(Pad pad) {
	final JTabbedPane sliders = new JTabbedPane();
	sliders.setFont(SMALL_FONT);
	sliders.setPreferredSize(new Dimension(200, 400));
	for (int i = 0; i < profile.getFilterNumber(); i++) {
		sliders.addTab("Filter" + (i + 1), makePadArea(pad.getFilter(i)));
	}

	return sliders;
}
 
Example 12
Source File: DialogDemo.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
/** Creates the GUI shown inside the frame's content pane. */
public DialogDemo(JFrame frame) {
    super(new BorderLayout());
    this.frame = frame;
    customDialog = new CustomDialog(frame, "geisel", this);
    customDialog.pack();

    // Create the components.
    JPanel frequentPanel = createSimpleDialogBox();
    JPanel featurePanel = createFeatureDialogBox();
    JPanel iconPanel = createIconDialogBox();
    label = new JLabel("Click the \"Show it!\" button" + " to bring up the selected dialog.", JLabel.CENTER);

    // Lay them out.
    Border padding = BorderFactory.createEmptyBorder(20, 20, 5, 20);
    frequentPanel.setBorder(padding);
    featurePanel.setBorder(padding);
    iconPanel.setBorder(padding);

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Simple Modal Dialogs", null, frequentPanel, simpleDialogDesc); // tooltip
                                                                                      // text
    tabbedPane.addTab("More Dialogs", null, featurePanel, moreDialogDesc); // tooltip
                                                                           // text
    tabbedPane.addTab("Dialog Icons", null, iconPanel, iconDesc); // tooltip
                                                                  // text

    add(tabbedPane, BorderLayout.CENTER);
    add(label, BorderLayout.PAGE_END);
    label.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
}
 
Example 13
Source File: TechniqueEditor.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link Technique} editor.
 *
 * @param technique The {@link Technique} to edit.
 */
public TechniqueEditor(Technique technique) {
    super(technique);

    JPanel    content = new JPanel(new ColumnLayout(2));
    JPanel    fields  = new JPanel(new ColumnLayout(2));
    JLabel    icon    = new JLabel(technique.getIcon(true));
    Container wrapper;

    mNameField = createCorrectableField(fields, fields, I18n.Text("Name"), technique.getName(), I18n.Text("The base name of the technique, without any notes or specialty information"));
    mNotesField = createField(fields, fields, I18n.Text("Notes"), technique.getNotes(), I18n.Text("Any notes that you would like to show up in the list along with this technique"), 0);
    mCategoriesField = createField(fields, fields, I18n.Text("Categories"), technique.getCategoriesAsString(), I18n.Text("The category or categories the technique belongs to (separate multiple categories with a comma)"), 0);
    createDefaults(fields);
    createLimits(fields);
    wrapper = createDifficultyPopups(fields);
    mReferenceField = createField(wrapper, wrapper, I18n.Text("Page Reference"), mRow.getReference(), I18n.Text("A reference to the book and page this technique appears on (e.g. B22 would refer to \"Basic Set\", page 22)"), 6);
    icon.setVerticalAlignment(SwingConstants.TOP);
    icon.setAlignmentY(-1.0f);
    content.add(icon);
    content.add(fields);
    add(content);

    mTabPanel = new JTabbedPane();
    mPrereqs = new PrereqsPanel(mRow, mRow.getPrereqs());
    mFeatures = new FeaturesPanel(mRow, mRow.getFeatures());
    mMeleeWeapons = MeleeWeaponEditor.createEditor(mRow);
    mRangedWeapons = RangedWeaponEditor.createEditor(mRow);
    Component panel = embedEditor(mPrereqs);
    mTabPanel.addTab(panel.getName(), panel);
    panel = embedEditor(mFeatures);
    mTabPanel.addTab(panel.getName(), panel);
    mTabPanel.addTab(mMeleeWeapons.getName(), mMeleeWeapons);
    mTabPanel.addTab(mRangedWeapons.getName(), mRangedWeapons);
    UIUtilities.selectTab(mTabPanel, getLastTabName());
    add(mTabPanel);
}
 
Example 14
Source File: GuiMain.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static JTabbedPane makeTabbedPane(CliGuiContext cliGuiCtx, JPanel output) {
    JTabbedPane tabs = new JTabbedPane();
    ManagementModel mgtModel = new ManagementModel(cliGuiCtx);
    tabs.addTab("Command Builder", mgtModel);

    ManagementModelNode loggingSubsys = mgtModel.findNode("/subsystem=logging/");
    if (loggingSubsys != null && cliGuiCtx.isStandalone() && ServerLogsPanel.isLogDownloadAvailable(cliGuiCtx)) {
        tabs.addTab("Server Logs", new ServerLogsPanel(cliGuiCtx));
    }
    tabs.addTab("Output", output);
    return tabs;
}
 
Example 15
Source File: HelpFrame.java    From RegexReplacer with MIT License 4 votes vote down vote up
private HelpFrame() {
	setTitle(StrUtils.getStr("HelpFrame.title"));
	setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	jtp = new JTabbedPane();
	try {
		JEditorPane regexPane = new JEditorPane(RegexReplacer.class
				.getClassLoader().getResource(
						StrUtils.getStr("html.JavaRegex")));
		regexPane.setEditable(false);
		// regexPane.addHyperlinkListener(new HyperlinkListener() {
		// @Override
		// public void hyperlinkUpdate(HyperlinkEvent e) {
		// if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED){
		// URL url = e.getURL();
		// try {
		// ((JEditorPane) e.getSource()).setPage(url);
		// } catch (IOException e1) {
		// e1.printStackTrace();
		// }
		// }
		// }
		// });
		jtp.addTab(regexHelp, new JScrollPane(regexPane));

		JEditorPane helpPane = new JEditorPane(RegexReplacer.class
				.getClassLoader().getResource(StrUtils.getStr("html.Help")));
		helpPane.setEditable(false);
		jtp.addTab(help, new JScrollPane(helpPane));
		JEditorPane functionsPane = new JEditorPane(RegexReplacer.class
				.getClassLoader().getResource(
						StrUtils.getStr("html.Functions")));
		functionsPane.setEditable(false);
		jtp.addTab(functionsHelp, new JScrollPane(functionsPane));
		JEditorPane newFunctionPane = new JEditorPane(RegexReplacer.class
				.getClassLoader().getResource(
						StrUtils.getStr("html.NewFunction")));
		newFunctionPane.setEditable(false);
		jtp.addTab(newFunctionHelp, new JScrollPane(newFunctionPane));
	} catch (IOException e) {
		e.printStackTrace();
	}
	add(jtp);
	setSize(700, 500);
	setLocationRelativeTo(null);
}
 
Example 16
Source File: EditPreferences.java    From iBioSim with Apache License 2.0 4 votes vote down vote up
public void preferences() {
	Preferences biosimrc = Preferences.userRoot();
	if (biosimrc.get("biosim.check.undeclared", "").equals("false")) {
		checkUndeclared = false;
	}
	else {
		checkUndeclared = true;
	}
	if (biosimrc.get("biosim.check.units", "").equals("false")) {
		checkUnits = false;
	}
	else {
		checkUnits = true;
	}
	JPanel generalPrefs = generalPreferences(biosimrc);
	JPanel schematicPrefs = schematicPreferences(biosimrc);
	JPanel modelPrefs = modelPreferences(biosimrc);
	JPanel analysisPrefs = analysisPreferences(biosimrc);

	// create tabs
	JTabbedPane prefTabs = new JTabbedPane();
	if (async) prefTabs.addTab("General Preferences", generalPrefs);
	if (async) prefTabs.addTab("Schematic Preferences", schematicPrefs);
	if (async) prefTabs.addTab("Model Preferences", modelPrefs);
	if (async) prefTabs.addTab("Analysis Preferences", analysisPrefs);

	boolean problem;
	int value;
	do {
		problem = false;
		Object[] options = { "Save", "Cancel" };
		value = JOptionPane.showOptionDialog(frame, prefTabs, "Preferences", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null,
				options, options[0]);

		// if user hits "save", store and/or check new data
		if (value == JOptionPane.YES_OPTION) {
			if (async) saveGeneralPreferences(biosimrc);
			if (async) problem = saveSchematicPreferences(biosimrc);
			if (async && !problem) problem = saveModelPreferences(biosimrc);
			if (async && !problem) problem = saveAnalysisPreferences(biosimrc);
			try {
				biosimrc.sync();
			}
			catch (BackingStoreException e) {
				e.printStackTrace();
			}
		}
	} while (value == JOptionPane.YES_OPTION && problem);
}
 
Example 17
Source File: GUIMain.java    From PacketProxy with Apache License 2.0 4 votes vote down vote up
private GUIMain(String title) {
	try {
		setLookandFeel();
		setTitle(title);
		setBounds(10, 10, 1100, 850);
		enableFullScreenForMac(this);

		menu_bar = new GUIMenu(this);
		setJMenuBar(menu_bar);

		gui_option = new GUIOption(this);
		gui_history = getGUIHistory();
		gui_intercept = new GUIIntercept(this);
		gui_repeater = GUIRepeater.getInstance();
		gui_bulksender = GUIBulkSender.getInstance();
		gui_log = GUILog.getInstance();

		tabbedpane = new JTabbedPane();
		tabbedpane.addTab(getPaneString(Panes.HISTORY), gui_history.createPanel());
		tabbedpane.addTab(getPaneString(Panes.INTERCEPT), gui_intercept.createPanel());
		tabbedpane.addTab(getPaneString(Panes.REPEATER), gui_repeater.createPanel());
		tabbedpane.addTab(getPaneString(Panes.BULKSENDER), gui_bulksender.createPanel());
		tabbedpane.addTab(getPaneString(Panes.OPTIONS), gui_option.createPanel());
		tabbedpane.addTab(getPaneString(Panes.LOG), gui_log.createPanel());

		getContentPane().add(tabbedpane, BorderLayout.CENTER);

		interceptModel = InterceptModel.getInstance();
		interceptModel.addObserver(this);
		final Container cp = getContentPane();

		//// 終了時の処理
		addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent event) {
				System.exit(0);
			}
		});
		gui_history.updateAllAsync();
	} catch (Exception e) {
		PacketProxyUtility.getInstance().packetProxyLogErrWithStackTrace(e);
		e.printStackTrace();
	}
}
 
Example 18
Source File: SpellEditor.java    From gcs with Mozilla Public License 2.0 4 votes vote down vote up
/**
 * Creates a new {@link Spell} editor.
 *
 * @param spell The {@link Spell} to edit.
 */
public SpellEditor(Spell spell) {
    super(spell);

    boolean   notContainer = !spell.canHaveChildren();
    Container content      = new JPanel(new ColumnLayout(2));
    Container fields       = new JPanel(new ColumnLayout());
    Container wrapper1     = new JPanel(new ColumnLayout(notContainer ? 3 : 2));
    Container wrapper2     = new JPanel(new ColumnLayout(4));
    Container wrapper3     = new JPanel(new ColumnLayout(2));
    Container noGapWrapper = new JPanel(new ColumnLayout(2, 0, 0));
    Container ptsPanel     = null;
    JLabel    icon         = new JLabel(spell.getIcon(true));
    Dimension size         = new Dimension();
    Container refParent    = wrapper3;

    mNameField = createCorrectableField(wrapper1, wrapper1, I18n.Text("Name"), spell.getName(), I18n.Text("The name of the spell, without any notes"));
    fields.add(wrapper1);
    if (notContainer) {
        createTechLevelFields(wrapper1);
        mCollegeField = createField(wrapper2, wrapper2, I18n.Text("College"), spell.getCollege(), I18n.Text("The college the spell belongs to"), 0);
        mPowerSourceField = createField(wrapper2, wrapper2, I18n.Text("Power Source"), spell.getPowerSource(), I18n.Text("The source of power for the spell"), 0);
        mClassField = createCorrectableField(wrapper2, wrapper2, I18n.Text("Class"), spell.getSpellClass(), I18n.Text("The class of spell (Area, Missile, etc.)"));
        mCastingCostField = createCorrectableField(wrapper2, wrapper2, I18n.Text("Casting Cost"), spell.getCastingCost(), I18n.Text("The casting cost of the spell"));
        mMaintenanceField = createField(wrapper2, wrapper2, I18n.Text("Maintenance Cost"), spell.getMaintenance(), I18n.Text("The cost to maintain a spell after its initial duration"), 0);
        mCastingTimeField = createCorrectableField(wrapper2, wrapper2, I18n.Text("Casting Time"), spell.getCastingTime(), I18n.Text("The casting time of the spell"));
        mResistField = createCorrectableField(wrapper2, wrapper2, I18n.Text("Resist"), spell.getResist(), I18n.Text("The resistance roll, if any"));
        mDurationField = createCorrectableField(wrapper2, wrapper2, I18n.Text("Duration"), spell.getDuration(), I18n.Text("The duration of the spell once its cast"));
        fields.add(wrapper2);

        ptsPanel = createPointsFields();
        fields.add(ptsPanel);
        refParent = ptsPanel;
    }
    mNotesField = createField(wrapper3, wrapper3, I18n.Text("Notes"), spell.getNotes(), I18n.Text("Any notes that you would like to show up in the list along with this spell"), 0);
    mCategoriesField = createField(wrapper3, wrapper3, I18n.Text("Categories"), spell.getCategoriesAsString(), I18n.Text("The category or categories the spell belongs to (separate multiple categories with a comma)"), 0);
    mReferenceField = createField(refParent, noGapWrapper, I18n.Text("Page Reference"), mRow.getReference(), I18n.Text("A reference to the book and page this spell appears on (e.g. B22 would refer to \"Basic Set\", page 22)"), 6);
    noGapWrapper.add(new JPanel());
    refParent.add(noGapWrapper);
    fields.add(wrapper3);

    determineLargest(wrapper1, 3, size);
    determineLargest(wrapper2, 4, size);
    if (ptsPanel != null) {
        determineLargest(ptsPanel, 100, size);
    }
    determineLargest(wrapper3, 2, size);
    applySize(wrapper1, 3, size);
    applySize(wrapper2, 4, size);
    if (ptsPanel != null) {
        applySize(ptsPanel, 100, size);
    }
    applySize(wrapper3, 2, size);

    icon.setVerticalAlignment(SwingConstants.TOP);
    icon.setAlignmentY(-1.0f);
    content.add(icon);
    content.add(fields);
    add(content);

    if (notContainer) {
        mTabPanel = new JTabbedPane();
        mPrereqs = new PrereqsPanel(mRow, mRow.getPrereqs());
        mMeleeWeapons = MeleeWeaponEditor.createEditor(mRow);
        mRangedWeapons = RangedWeaponEditor.createEditor(mRow);
        Component panel = embedEditor(mPrereqs);
        mTabPanel.addTab(panel.getName(), panel);
        mTabPanel.addTab(mMeleeWeapons.getName(), mMeleeWeapons);
        mTabPanel.addTab(mRangedWeapons.getName(), mRangedWeapons);
        if (!mIsEditable) {
            UIUtilities.disableControls(mMeleeWeapons);
            UIUtilities.disableControls(mRangedWeapons);
        }
        UIUtilities.selectTab(mTabPanel, getLastTabName());
        add(mTabPanel);
    }
}
 
Example 19
Source File: TypesConfigFrame.java    From ontopia with Apache License 2.0 4 votes vote down vote up
private void build() {
  setTitle(model.getTitle());

  // populate JList
  typeList = new JList<>();
  initializeTypeList();
  
  // Set the first
  typeList.setSelectedIndex(0);
  selectedType = typeList.getSelectedValue().getTopic();

  // setup UI
  getContentPane().setLayout(new GridBagLayout());
  GridBagConstraints c = new GridBagConstraints();

  c.fill = GridBagConstraints.BOTH;
  typeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  typeList.addListSelectionListener(this);

  JScrollPane scrlPane = new JScrollPane(typeList);
  getContentPane().add(scrlPane, c);

  JTabbedPane tabbedPane = new JTabbedPane();
  
  tabbedPane
      .addTab(
          Messages.getString("Viz.StylingConfigTitle"), null,
              createGeneralConfigPanel(),
          Messages.getString("Viz.StylingConfigHoverHelp"));
  tabbedPane
      .addTab(
          Messages.getString("Viz.ColourConfigTitle"), null,
              createColorChooserPanel(),
          Messages.getString("Viz.ColourConfigHoverHelp"));
  tabbedPane
      .addTab(
          Messages.getString("Viz.FontConfigTitle"), null,
              createFontSelectionPanel(),
          Messages.getString("Viz.FontConfigHoverHelp"));
  tabbedPane
      .addTab(Messages.getString("Viz.TypeFilter"), null,
              createFilterSelectionPanel(),
          Messages.getString("Viz.FilterConfigHoverHelp"));
  
  
  
  JPanel parent = new JPanel();
  parent.setLayout(new BoxLayout(parent, BoxLayout.Y_AXIS));
  parent.add(tabbedPane);
  parent.add(createDefaultPanel());
  getContentPane().add(parent, c);
  
  pack();
  setResizable(false);
  
  defaultColorSettingCheckbox.update();
}
 
Example 20
Source File: CEDefinitionPanel.java    From open-ig with GNU Lesser General Public License v3.0 4 votes vote down vote up
/** Initialize the content. */
void initComponents() {
	
	JLabel directoryLabel = new JLabel(get("definition.Directory"));
	directory = new JTextField();
	directory.setEditable(false);
	JButton openDir = new JButton(get("definition.Directory.Open"));

	JPanel panel2 = new JPanel();
	GroupLayout gl = new GroupLayout(panel2);
	panel2.setLayout(gl);
	gl.setAutoCreateContainerGaps(true);
	gl.setAutoCreateGaps(true);
	
	gl.setHorizontalGroup(
		gl.createParallelGroup()
		.addGroup(
			gl.createSequentialGroup()
			.addComponent(directoryLabel)
			.addComponent(directory)
			.addComponent(openDir)
		)
	);
	
	gl.setVerticalGroup(
		gl.createSequentialGroup()
		.addGroup(
			gl.createParallelGroup(Alignment.BASELINE)
			.addComponent(directoryLabel)
			.addComponent(directory, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			.addComponent(openDir)
		)
	);
	
	tabs = new JTabbedPane();
	tabs.addTab(get("definition.Texts"), createTextsPanel());
	tabs.addTab(get("definition.References"), createReferencesPanel());
	tabs.addTab(get("definition.Properties"), createPropertiesPanel());
	
	setLayout(new BorderLayout());
	add(panel2, BorderLayout.PAGE_START);
	add(tabs, BorderLayout.CENTER);
	
	// ---------------------------------
	
	openDir.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			
			if (Desktop.isDesktopSupported()) {
				Desktop d = Desktop.getDesktop();
				try {
					d.open(context.dataManager().getDefinitionDirectory().getCanonicalFile());
				} catch (IOException e1) {
					Exceptions.add(e1);
				}
			}
		}
	});
}