javax.swing.JPanel Java Examples

The following examples show how to use javax.swing.JPanel. 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: AboutBoxDialog.java    From bigtable-sql with Apache License 2.0 6 votes vote down vote up
private JPanel createButtonBar()
	{
		_closeBtn.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent evt)
			{
				setVisible(false);
			}
		});

		final ButtonBarBuilder builder = new ButtonBarBuilder();
		builder.addGlue();
//		builder.addGridded(new JButton("Alter"));
//		builder.addRelatedGap();
		builder.addGridded(_closeBtn);

		return builder.getPanel();
	}
 
Example #2
Source File: InstrumentBrowser.java    From jsyn with Apache License 2.0 6 votes vote down vote up
public InstrumentBrowser(InstrumentLibrary library) {
    this.library = library;
    JPanel horizontalPanel = new JPanel();
    horizontalPanel.setLayout(new GridLayout(1, 2));

    final JList<VoiceDescription> instrumentList = new JList<VoiceDescription>(library.getVoiceDescriptions());
    setupList(instrumentList);
    instrumentList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting() == false) {
                int n = instrumentList.getSelectedIndex();
                if (n >= 0) {
                    showPresetList(n);
                }
            }
        }
    });

    JScrollPane listScroller1 = new JScrollPane(instrumentList);
    listScroller1.setPreferredSize(new Dimension(250, 120));
    add(listScroller1);

    instrumentList.setSelectedIndex(0);
}
 
Example #3
Source File: WmsAssistantPage2.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Component createPageComponent() {
    JPanel panel = new JPanel(new BorderLayout(4, 4));
    panel.setBorder(new EmptyBorder(4, 4, 4, 4));
    panel.add(new JLabel("Available layers:"), BorderLayout.NORTH);

    LayerSourcePageContext context = getContext();
    modelCRS = (CoordinateReferenceSystem) context.getLayerContext().getCoordinateReferenceSystem();

    WMSCapabilities wmsCapabilities = (WMSCapabilities) context.getPropertyValue(
            WmsLayerSource.PROPERTY_NAME_WMS_CAPABILITIES);
    layerTree = new JTree(new WmsTreeModel(wmsCapabilities.getLayer()));
    layerTree.setRootVisible(false);
    layerTree.setShowsRootHandles(true);
    layerTree.setExpandsSelectedPaths(true);
    layerTree.setCellRenderer(new MyDefaultTreeCellRenderer());
    layerTree.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    layerTree.getSelectionModel().addTreeSelectionListener(new LayerTreeSelectionListener());
    panel.add(new JScrollPane(layerTree), BorderLayout.CENTER);
    infoLabel = new JLabel(" ");
    panel.add(infoLabel, BorderLayout.SOUTH);
    getContext().setPropertyValue(WmsLayerSource.PROPERTY_NAME_SELECTED_LAYER, null);
    return panel;
}
 
Example #4
Source File: AttributeEditorPanel.java    From ramus with GNU General Public License v3.0 6 votes vote down vote up
public AttributeEditorPanel() {
    super(new BorderLayout());
    okc = new JPanel(new GridLayout(1, 3, 5, 0));

    JButton ok = new JButton(okAction);

    cancel = new JButton(cancelAction);

    apply = new JButton(applyAction);

    addOk(ok, okc);
    okc.add(apply);
    okc.add(cancel);
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5));
    panel.add(okc);
    this.add(panel, BorderLayout.SOUTH);
    setAttributeEditor(null, null, null, null, false, null);
}
 
Example #5
Source File: StatusPanel.java    From ramus with GNU General Public License v3.0 6 votes vote down vote up
/**
 * This method initializes this
 *
 * @return void
 */
private void initialize() {
    double[][] size = {{5, TableLayout.FILL, 5},
            {5, TableLayout.FILL, 5}};
    this.setLayout(new TableLayout(size));
    final GridLayout gridLayout3 = new GridLayout();
    JPanel child = new JPanel(gridLayout3);
    this.setSize(351, 105);
    gridLayout3.setRows(3);
    gridLayout3.setColumns(2);
    gridLayout3.setHgap(5);
    gridLayout3.setVgap(5);
    child.add(getJRadioButton(), null);
    child.add(getJRadioButton1(), null);
    child.add(getJRadioButton2(), null);
    child.add(getJRadioButton3(), null);
    child.add(getJRadioButton4(), null);
    child.add(getJTextField(), null);
    this.add(child, "1,1");
}
 
Example #6
Source File: ClockTabPanel.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private JPanel createHeaderPanel(String title, String type, boolean largePadding, ActionListener actionListener)
{
	JPanel panel = new JPanel(new BorderLayout());
	panel.setBorder(new EmptyBorder(largePadding ? 11 : 0, 0, 0, 0));
	panel.setBackground(ColorScheme.DARK_GRAY_COLOR);

	JLabel headerLabel = new JLabel(title);
	headerLabel.setForeground(Color.WHITE);
	headerLabel.setFont(FontManager.getRunescapeSmallFont());
	panel.add(headerLabel, BorderLayout.CENTER);

	JButton addButton = new JButton(ADD_ICON);
	addButton.setRolloverIcon(ADD_ICON_HOVER);
	SwingUtil.removeButtonDecorations(addButton);
	addButton.setPreferredSize(new Dimension(14, 14));
	addButton.setToolTipText("Add a " + type);
	addButton.addActionListener(actionListener);
	panel.add(addButton, BorderLayout.EAST);

	return panel;
}
 
Example #7
Source File: TestObject.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void validate(XMLDecoder decoder) {
    JPanel panel = (JPanel) decoder.readObject();
    if (2 != panel.getComponents().length) {
        throw new Error("unexpected component count");
    }
    JButton button = (JButton) panel.getComponents()[0];
    if (!button.getText().equals("button")) { // NON-NLS: hardcoded in XML
        throw new Error("unexpected button text");
    }
    if (SwingConstants.CENTER != button.getVerticalAlignment()) {
        throw new Error("unexpected vertical alignment");
    }
    JLabel label = (JLabel) panel.getComponents()[1];
    if (!label.getText().equals("label")) { // NON-NLS: hardcoded in XML
        throw new Error("unexpected label text");
    }
    if (button != label.getLabelFor()) {
        throw new Error("unexpected component");
    }
}
 
Example #8
Source File: FmtOptions.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected CategorySupport(String mimeType, Defaults.Provider provider, Preferences preferences, String id,
        JPanel panel, String previewText, String[]... forcedOptions) {
    this.mimeType = mimeType;
    this.provider = provider;
    this.preferences = preferences;
    this.id = id;
    this.panel = panel;
    this.previewText = previewText != null ? previewText : NbBundle.getMessage(FmtOptions.class, "SAMPLE_Default"); //NOI18N

    // Scan the panel for its components
    scan(panel, components);

    // Initialize the preview preferences
    Preferences forcedPrefs = new PreviewPreferences();
    for (String[] option : forcedOptions) {
        forcedPrefs.put( option[0], option[1]);
    }
    this.previewPrefs = new ProxyPreferences(preferences, forcedPrefs);

    // Load and hook up all the components
    loadFrom(preferences);
    addListeners();
}
 
Example #9
Source File: ClientComponent.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
protected void initUi() {
    // Common
    buttonShowView =
            new JToggleButton(
                    new ImageIcon(
                            HttpPanelComponentInterface.class.getResource(
                                    ExtensionPlugNHack.CLIENT_ACTIVE_ICON_RESOURCE)));

    buttonShowView.setToolTipText(BUTTON_TOOL_TIP);

    panelOptions = new JPanel();
    panelOptions.add(views.getSelectableViewsComponent());

    informationLabel = new JLabel();
    panelMoreOptions = new JPanel();
    panelMoreOptions.add(informationLabel);

    initViews();

    // All
    panelMain = new JPanel(new BorderLayout());
    panelMain.add(views.getViewsPanel());

    setSelected(false);
}
 
Example #10
Source File: DocumentsDlg.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private JPanel createListView () {
    JPanel panel = new JPanel();
    // Defined size in #36907 - surrounding controls will add to this size
    // and result is desired 540x400. Note that we can't hardcode size of
    // whole dialog to work correctly with different font size
    panel.setPreferredSize(new Dimension(375, 232));
    panel.setLayout(new BorderLayout());
    listView = new ListView();
    // proper border for the view
    listView.setBorder((Border)UIManager.get("Nb.ScrollPane.border")); // NOI18N
    listView.setPopupAllowed(false);
    listView.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(DocumentsDlg.class, "ACSD_ListView"));
    //view.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listView.getInputMap( JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ).put( KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "closeSelected") ;//NOI18N
    listView.getActionMap().put( "closeSelected", new AbstractAction() {//NOI18N
        @Override
        public void actionPerformed( ActionEvent e ) {
            closeDocuments(e );
        }

    });
    panel.add(listView, BorderLayout.CENTER);
    return panel;
}
 
Example #11
Source File: AbstractCharsetProcessorUIPanel.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
protected JPanel createDefaultFieldsPanel() {
    JPanel fieldsPanel = new JPanel();

    GroupLayout layout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);

    layout.setHorizontalGroup(
            layout.createSequentialGroup()
                    .addComponent(getCharsetLabel())
                    .addComponent(getCharsetComboBox()));

    layout.setVerticalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(getCharsetLabel())
                    .addComponent(getCharsetComboBox()));
    return fieldsPanel;
}
 
Example #12
Source File: SectorNameEditor.java    From ramus with GNU General Public License v3.0 6 votes vote down vote up
private Component getReplacemetPanel() {
    JPanel group = new JPanel(new GridLayout(0, 1));
    group.setBorder(BorderFactory.createTitledBorder(ResourceLoader
            .getString("ArrowReplacementType.name")));
    group.add(safe = new JRadioButton("ArrowReplacementType.safe"));
    group.add(children = new JRadioButton("ArrowReplacementType.branching"));
    group.add(all = new JRadioButton("ArrowReplacementType.everywhere"));
    safe.setSelected(true);

    ButtonGroup g = new ButtonGroup();
    g.add(children);
    g.add(all);
    g.add(safe);

    setReplaceEnable(false);

    return group;
}
 
Example #13
Source File: GameOptionsDialog.java    From megamek with GNU General Public License v2.0 6 votes vote down vote up
public void refreshOptions() {
    panOptions.removeAll();
    optionComps = new HashMap<>();

    for (Enumeration<IOptionGroup> i = options.getGroups(); i.hasMoreElements();) {
        IOptionGroup group = i.nextElement();

        JPanel groupPanel = addGroup(group);

        for (Enumeration<IOption> j = group.getOptions(); j.hasMoreElements();) {
            IOption option = j.nextElement();
            addOption(groupPanel, option);
        }
    }

    addSearchPanel();

    // Make the width accomadate the longest game option label
    // without needing to scroll horizontally.
    setSize(Math.max(getSize().width, maxOptionWidth + 30), Math.max(getSize().height, 400));

    validate();
}
 
Example #14
Source File: ElementSelectorPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public ElementSelectorPanel(ElementNode.Description elementDescription, boolean singleSelection, boolean enableButtons ) {      
    setLayout(new BorderLayout());
    elementView = new CheckTreeView();
    elementView.setRootVisible(false);
    add(elementView, BorderLayout.CENTER);
    setRootElement(elementDescription, singleSelection);
    //make sure that the first element is pre-selected
    Node root = manager.getRootContext();
    Node[] children = root.getChildren().getNodes();
    if( null != children && children.length > 0 && !elementDescription.hasSelection(true)) {
        try {
            manager.setSelectedNodes(new org.openide.nodes.Node[]{children[0]});
        } catch (PropertyVetoException ex) {
            //ignore
        }
    }
    if (!singleSelection && hasMultipleSelectables(elementDescription)) {
        final JButton selectAll = new JButton();
        final JButton selectNone = new JButton();
        Mnemonics.setLocalizedText(selectAll, Bundle.BTN_SelectAll());
        Mnemonics.setLocalizedText(selectNone, Bundle.BTN_SelectNone());
        JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
        buttonPanel.add(selectAll);
        buttonPanel.add(selectNone);

        add(buttonPanel, BorderLayout.SOUTH);
        
        ActionListener al = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                selectAllNodes(e.getSource() == selectAll);
            }
        };
        selectAll.addActionListener(al);
        selectNone.addActionListener(al);
    }
}
 
Example #15
Source File: ArrayInspector.java    From osp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates the GUI.
 */
protected void createGUI() {
  setSize(400, 300);
  setContentPane(new JPanel(new BorderLayout()));
  scrollpane = new JScrollPane(tables[0]);
  if(tables.length>1) {
    // create spinner
    SpinnerModel model = new SpinnerNumberModel(0, 0, tables.length-1, 1);
    spinner = new JSpinner(model);
    JSpinner.NumberEditor editor = new JSpinner.NumberEditor(spinner);
    editor.getTextField().setFont(tables[0].getFont());
    spinner.setEditor(editor);
    spinner.addChangeListener(new ChangeListener() {
      public void stateChanged(ChangeEvent e) {
        int i = ((Integer) spinner.getValue()).intValue();
        scrollpane.setViewportView(tables[i]);
      }

    });
    Dimension dim = spinner.getMinimumSize();
    spinner.setMaximumSize(dim);
    getContentPane().add(scrollpane, BorderLayout.CENTER);
    JToolBar toolbar = new JToolBar();
    toolbar.setFloatable(false);
    toolbar.add(new JLabel(" index ")); //$NON-NLS-1$
    toolbar.add(spinner);
    toolbar.add(Box.createHorizontalGlue());
    getContentPane().add(toolbar, BorderLayout.NORTH);
  } else {
    scrollpane.createHorizontalScrollBar();
    getContentPane().add(scrollpane, BorderLayout.CENTER);
  }
}
 
Example #16
Source File: ChartPagePanel.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
private JPanel createTopPanel() {
    refreshButton = ToolButtonFactory.createButton(
            UIUtils.loadImageIcon("icons/ViewRefresh22.png"),
            false);
    refreshButton.setToolTipText("Refresh View");
    refreshButton.setName("refreshButton");
    refreshButton.addActionListener(e -> {
        updateChartData();
        refreshButton.setEnabled(false);
    });

    AbstractButton switchToTableButton = ToolButtonFactory.createButton(
            UIUtils.loadImageIcon("icons/Table24.png"),
            false);
    switchToTableButton.setToolTipText("Switch to Table View");
    switchToTableButton.setName("switchToTableButton");
    switchToTableButton.setEnabled(hasAlternativeView());
    switchToTableButton.addActionListener(e -> showAlternativeView());

    final TableLayout tableLayout = new TableLayout(6);
    tableLayout.setColumnFill(2, TableLayout.Fill.HORIZONTAL);
    tableLayout.setColumnWeightX(2, 1.0);
    tableLayout.setRowPadding(0, new Insets(0, 4, 0, 0));
    JPanel buttonPanel = new JPanel(tableLayout);
    buttonPanel.add(refreshButton);
    tableLayout.setRowPadding(0, new Insets(0, 0, 0, 0));
    buttonPanel.add(switchToTableButton);
    buttonPanel.add(new JPanel());

    return buttonPanel;
}
 
Example #17
Source File: MultiGradientTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private JComboBox createCombo(JPanel panel, Enum e) {
    JComboBox cmb = new JComboBox();
    cmb.setModel(new EnumComboBoxModel(e.getClass()));
    cmb.addActionListener(this);
    panel.add(cmb);
    return cmb;
}
 
Example #18
Source File: FirstSwitchFrame.java    From ramus with GNU General Public License v3.0 5 votes vote down vote up
public FirstSwitchFrame() {
    setTitle(MessageFormat.format(GlobalResourcesManager
            .getString("File.Launcher"), Metadata.getApplicationName()));
    this.setIconImage(Toolkit.getDefaultToolkit().getImage(
            getClass().getResource("/com/ramussoft/gui/application.png")));
    JPanel bottom = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    JPanel buttons = new JPanel(new GridLayout(1, 2, 5, 0));
    fileLocation.setPreferredSize(new Dimension(500, fileLocation
            .getPreferredSize().width));
    fileLocation.setEditable(true);
    String[] files = Runner.getLastOpenedFiles();
    for (String file : files) {
        File file2 = new File(file);
        if ((file2.exists()) && (file2.canRead())) {
            fileLocation.addItem(file);
        }
    }

    String lastFile = Options.getString("LAST_FILE_FIRST");
    if (lastFile != null) {
        fileLocation.setSelectedItem(lastFile);
    }
    buttons.add(new JButton(okAction));
    buttons.add(new JButton(cancelAction));
    bottom.add(buttons);
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(bottom, BorderLayout.SOUTH);
    getContentPane().add(createCenterPanel(), BorderLayout.CENTER);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    pack();
    setResizable(false);
    setLocationRelativeTo(null);
    if (doNotAsk.isSelected()) {
        ok();
    }
}
 
Example #19
Source File: Attribute.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JPanel getTitleSection() {
        JPanel panel = new JPanel(new GridBagLayout());
        GridBagConstraints c = new GridBagConstraints();

        setLabelPanel(panel, c);
        setHeaderPanel(panel, c);
        setFooterPanel(panel, c);
        setMacroPanel(panel, c);
//      panel.setBorder(new javax.swing.border.LineBorder(java.awt.Color.red));

        return panel;
    }
 
Example #20
Source File: Test6657026.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new MetalLookAndFeel());

    ThreadGroup group = new ThreadGroup("$$$");
    Thread thread = new Thread(group, new Test6657026());
    thread.start();
    thread.join();

    new JInternalFrame().setContentPane(new JPanel());
}
 
Example #21
Source File: MessagePanel.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
private void setMessagePanelLayout(final JComponent container, SwingGameController aController) {

        final int GAP = 8; // pixels
        setLayout(new MigLayout("insets 0, gap " + GAP, "[][][grow,right]", "[top]"));

        JPanel playerPanel = getPlayerPanel();
        JPanel turnPanel = getTurnPanel();

        final Insets insets1 = container.getInsets();
        final Insets insets2 = SEPARATOR_BORDER.getBorderInsets(this);
        final int totalInsets = insets1.left + insets1.right + insets2.left + insets2.right;

        if (textLabelWidth == 0) {
            textLabelWidth =
                    container.getWidth() -
                    playerPanel.getPreferredSize().width -
                    turnPanel.getPreferredSize().width -
                    totalInsets -
                    (GAP * 2);
        }

        final TextLabel textLabel = new TextLabel(
            message.getText(),
            LogStackViewer.MESSAGE_FONT,
            textLabelWidth,
            false,
            LogStackViewer.CHOICE_COLOR,
            aController
        );

        add(playerPanel);
        add(textLabel);
        add(turnPanel);
    }
 
Example #22
Source File: GeometryApp.java    From arcgis-runtime-demo-java with Apache License 2.0 5 votes vote down vote up
/**
 * Creates and displays the UI, including the map, for this application.
 */
public JComponent createUI() throws Exception {
  // application content
  contentPane = new JPanel();
  contentPane.setLayout(new BorderLayout());

  // map
  map = createMap();
  contentPane.add(map, BorderLayout.CENTER);

  return contentPane;
}
 
Example #23
Source File: PreviewApplet.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void init() {
  addComponentListener( new RequestFocusHandler() );

  previewPane = new PreviewPane();
  previewPane.setDeferredRepagination( true );
  addComponentListener( new TriggerPaginationListener( previewPane ) );
  statusBar = new JStatusBar( previewPane.getIconTheme() );

  progressBar = new ReportProgressBar();
  progressBar.setVisible( false );
  previewPane.addReportProgressListener( progressBar );

  pageLabel = new JLabel();
  previewPane.addPropertyChangeListener( new PreviewPanePropertyChangeHandler() );

  final JComponent extensionArea = statusBar.getExtensionArea();
  extensionArea.setLayout( new BoxLayout( extensionArea, BoxLayout.X_AXIS ) );
  extensionArea.add( progressBar );
  extensionArea.add( pageLabel );

  final JComponent contentPane = new JPanel();
  contentPane.setLayout( new BorderLayout() );
  contentPane.add( previewPane, BorderLayout.CENTER );
  contentPane.add( statusBar, BorderLayout.SOUTH );
  setContentPane( contentPane );

  updateMenu( previewPane.getMenu() );
  statusBar.setIconTheme( previewPane.getIconTheme() );
  statusBar.setStatus( previewPane.getStatusType(), previewPane.getStatusText() );
}
 
Example #24
Source File: AnalyzeSizeToolWindowTest.java    From size-analyzer with Apache License 2.0 5 votes vote down vote up
@Test
public void selectingCategoryNodeChangesCategoryPanel() {
  JPanel toolPanel = toolWindow.getContent();
  Component[] components = toolPanel.getComponents();
  OnePixelSplitter splitter = (OnePixelSplitter) components[0];
  JBScrollPane leftPane = (JBScrollPane) splitter.getFirstComponent();
  JViewport leftView = leftPane.getViewport();
  Tree suggestionTree = (Tree) leftView.getView();

  assertThat(suggestionTree.getSelectionCount()).isEqualTo(0);

  TreePath webPPath = getTreePathWithString(suggestionTree, webPCategoryData.toString());
  suggestionTree.addSelectionPath(webPPath);
  JPanel rightPane = (JPanel) splitter.getSecondComponent();

  assertThat(suggestionTree.getSelectionCount()).isEqualTo(1);
  for (Component component : rightPane.getComponents()) {
    if (component instanceof SimpleColoredComponent) {
      assertThat(component.toString()).contains(webPCategoryData.toString());
      assertThat(component.toString()).contains("Estimated savings: 29.30 KB");
    } else if (component instanceof JPanel) {
      Component[] suggestionPanelComponents = ((JPanel) component).getComponents();
      assertThat(suggestionPanelComponents).hasLength(1);
      for (Component linkLabel : suggestionPanelComponents) {
        assertThat(((LinkLabel<?>) linkLabel).getText()).isEqualTo(SuggestionDataFactory.issueTypeNodeNames.get(IssueType.WEBP));
      }
    }
  }
}
 
Example #25
Source File: AboutControlPanel.java    From VanetSim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor for this control panel.
 */
public AboutControlPanel(){
	setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.fill = GridBagConstraints.BOTH;
	c.anchor = GridBagConstraints.PAGE_START;
	c.weightx = 0.5;
	c.weighty = 0;
	c.gridx = 0;
	c.gridy = 0;
	c.gridheight = 1;
	c.insets = new Insets(5,5,5,5);
	
	c.gridwidth = 1;
	
	//label for display of credits.
	++c.gridy;
	add(new JLabel("<html><b>" + Messages.getString("AboutDialog.creditsHeader") + "</b></html>"), c);
	++c.gridy;
	
	add(new TextAreaLabel(Messages.getString("AboutDialog.credits")), c);
	
	//to consume the rest of the space
	c.weighty = 1.0;
	++c.gridy;
	JPanel pane = new JPanel();
	pane.setOpaque(false);
	add(pane, c);
}
 
Example #26
Source File: Test6657026.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new MetalLookAndFeel());

    ThreadGroup group = new ThreadGroup("$$$");
    Thread thread = new Thread(group, new Test6657026());
    thread.start();
    thread.join();

    new JInternalFrame().setContentPane(new JPanel());
}
 
Example #27
Source File: VideoReceiver.java    From Spark with Apache License 2.0 5 votes vote down vote up
/**
 * ControllerListener for the Players.
 */
public synchronized void controllerUpdate(ControllerEvent ce) {

    Player p = (Player) ce.getSourceController();

    if (p == null)
        return;

    // Get this when the internal players are realized.
    if (ce instanceof RealizeCompleteEvent) {
        p.start();
        
        Component vc = p.getVisualComponent();
        System.out.println("Start1.1" + vc);
        if ( null != vc )
        {
            System.out.println("### visual component is " + vc);

            JFrame aFrame = new JFrame("Video Frame");
            JPanel aPanel = new JPanel();
            aPanel.setBounds(0, 0, 176, 144);
            aPanel.add(vc);
            aFrame.add(aPanel);

            aPanel.setBackground(Color.gray);

            vc.setVisible(true);
            aPanel.setVisible(true);
            aFrame.setVisible(true);
            aFrame.pack();
        }
    }

    if (ce instanceof ControllerErrorEvent) {
        p.removeControllerListener(this);
        System.err.println("Receiver internal error: " + ce);
    }

}
 
Example #28
Source File: SourceSelectionDialog.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
public SourceSelectionDialog(PCGenFrame frame, UIContext uiContext)
{
	super(frame, true);
	this.frame = frame;
	setTitle(LanguageBundle.getString("in_mnuSourcesLoadSelect")); //$NON-NLS-1$
	this.tabs = new JTabbedPane();
	this.basicPanel = new QuickSourceSelectionPanel();
	this.advancedPanel = new AdvancedSourceSelectionPanel(frame, uiContext);
	this.buttonPanel = new JPanel();
	this.loadButton = new JButton();
	CommonMenuText.name(loadButton, "load"); //$NON-NLS-1$
	this.cancelButton = new JButton();
	CommonMenuText.name(cancelButton, "cancel"); //$NON-NLS-1$

	this.deleteButton = new JButton();
	CommonMenuText.name(deleteButton, "delete"); //$NON-NLS-1$
	this.installDataButton = new JButton();
	CommonMenuText.name(installDataButton, "mnuSourcesInstallData"); //$NON-NLS-1$
	this.saveButton = new JButton();
	CommonMenuText.name(saveButton, "saveSelection"); //$NON-NLS-1$
	this.alwaysAdvancedCheck = new JCheckBox(LanguageBundle.getString("in_sourceAlwaysAdvanced"), //$NON-NLS-1$
		!UIPropertyContext.getInstance().initBoolean(UIPropertyContext.SOURCE_USE_BASIC_KEY, true));
	setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
	initComponents();
	initDefaults();
	pack();
}
 
Example #29
Source File: FancyDropDownButton.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
public JButton addToToolbar(JPanel toolbar, Object mainButtonConstraints, Object arrowButtonConstraints) {
	arrowButtonPanel.add(arrowButton);
	arrowButtonPanel.add(emptyPanel);
	toolbar.add(mainButton, mainButtonConstraints);
	toolbar.add(arrowButtonPanel, arrowButtonConstraints);
	return mainButton;
}
 
Example #30
Source File: CommentsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JPanel createTextPanelPlaceholder() {
    JPanel placeholder = new JPanel();
    placeholder.setBackground(blueBackground);
    GroupLayout layout = new GroupLayout(placeholder);
    placeholder.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, ICON_WIDTH, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE));
    return placeholder;
}