Java Code Examples for javax.swing.JPanel.add()

The following are Jave code examples for showing how to use add() of the javax.swing.JPanel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: trashjam2017   File: GradientEditor.java   View Source Code Vote up 6 votes
/**
 * Simple test case for the gradient painter
 * 
 * @param argv The arguments supplied at the command line
 */
public static void main(String[] argv) {
	JFrame frame = new JFrame();
	JPanel panel = new JPanel();
	panel.setBorder(BorderFactory.createTitledBorder("Gradient"));
	panel.setLayout(null);
	frame.setContentPane(panel);
		
	GradientEditor editor = new GradientEditor();
	editor.setBounds(10,15,270,100);
	panel.add(editor);
	frame.setSize(300,200);
	
	frame.addWindowListener(new WindowAdapter() {
		public void windowClosing(WindowEvent e) {
			System.exit(0);
		}
	});
	
	frame.setVisible(true);
}
 
Example 2
Project: KeysPerSecond   File: CommandKeys.java   View Source Code Vote up 6 votes
/**
 * Prompts the user for a new command key
 * @return The new command key or null
 */
protected static CMD askForNewKey(){
	JPanel form = new JPanel(new GridLayout(3, 1));
	JLabel txt = new JLabel("Press a key and click 'OK'");
	JPanel a = new JPanel(new BorderLayout());
	JPanel c = new JPanel(new BorderLayout());
	JCheckBox ctrl = new JCheckBox();
	JCheckBox alt = new JCheckBox();
	c.add(ctrl, BorderLayout.LINE_START);
	c.add(new JLabel("Ctrl"), BorderLayout.CENTER);
	a.add(alt, BorderLayout.LINE_START);
	a.add(new JLabel("Alt"), BorderLayout.CENTER);
	form.add(txt);
	form.add(c);
	form.add(a);
	if(JOptionPane.showOptionDialog(Main.frame.isVisible() ? Main.frame : null, form, "Keys per second", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[]{"OK", "Cancel"}, 0) == 0){
		if(Main.lastevent == null){
			return null;
		}
		CMD cmd = new CMD(Main.lastevent.getKeyCode(), isAltDown || alt.isSelected(), isCtrlDown || ctrl.isSelected());
		if(JOptionPane.showOptionDialog(Main.frame.isVisible() ? Main.frame : null, "Set command key to: " + cmd.toString(), "Keys per second", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[]{"OK", "Cancel"}, 0) == 0){
			return cmd;
		}
	}
	return null;
}
 
Example 3
Project: routerapp   File: LocalSearchSettings.java   View Source Code Vote up 6 votes
public void actionPerformed (ActionEvent evt) {
	centerPanel = new JPanel(new FlowLayout());
					
	iterationsLabel = new JLabel("Iterations");		
	iterationsField = new JTextField((new Integer(VRProblemModel.DEFAULT_LSD_ITERATIONS)).toString(), 4);

	lambdaLabel = new JLabel("Lambda size");		
	lambdaField = new JTextField((new Integer(VRProblemModel.DEFAULT_LAMBDA)).toString(), 4);
	
	globalBestSearchBox = new JCheckBox("Global Best Search");
	badMovesBox = new JCheckBox("Accept Bad Moves");

	centerPanel.add(iterationsLabel);
	centerPanel.add(iterationsField);
	centerPanel.add(lambdaLabel);
	centerPanel.add(lambdaField);			
	centerPanel.add(globalBestSearchBox);
	centerPanel.add(badMovesBox);	
			
	// Add demands table in Center Panel		
	centerPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
	centerPanel.setBackground(Color.getColor("202,198,202"));

	// Add panels in Main Panel
	getContentPane().add(centerPanel,BorderLayout.CENTER);					
}
 
Example 4
Project: Equella   File: NodeEditor.java   View Source Code Vote up 6 votes
protected JPanel createNamePanel(final JPanel panel)
{
	final JLabel nameLabel = new JLabel(CurrentLocale.get("com.tle.admin.workflow.editor.nodeeditor.name"));

	nameField = new I18nTextField(BundleCache.getLanguages());

	reject = new JCheckBox(CurrentLocale.get("com.tle.admin.workflow.editor.nodeeditor.reject"));

	final int height1 = nameLabel.getPreferredSize().height;
	final int height2 = nameField.getPreferredSize().height;
	final int height3 = reject.getPreferredSize().height;

	final int[] rows = {height1, height2, height3};
	final int[] cols = {300};

	panel.setLayout(new TableLayout(rows, cols));

	panel.add(nameLabel, new Rectangle(0, 0, 1, 1));
	panel.add(nameField, new Rectangle(0, 1, 1, 1));
	panel.add(reject, new Rectangle(0, 2, 1, 1));

	changeDetector.watch(nameField);
	changeDetector.watch(reject);

	return panel;
}
 
Example 5
Project: Logisim   File: WindowOptions.java   View Source Code Vote up 6 votes
public WindowOptions(PreferencesFrame window) {
	super(window);

	checks = new PrefBoolean[] {
			new PrefBoolean(AppPreferences.SHOW_TICK_RATE, Strings.getter("windowTickRate")), };

	toolbarPlacement = new PrefOptionList(AppPreferences.TOOLBAR_PLACEMENT, Strings.getter("windowToolbarLocation"),
			new PrefOption[] { new PrefOption(Direction.NORTH.toString(), Direction.NORTH.getDisplayGetter()),
					new PrefOption(Direction.SOUTH.toString(), Direction.SOUTH.getDisplayGetter()),
					new PrefOption(Direction.EAST.toString(), Direction.EAST.getDisplayGetter()),
					new PrefOption(Direction.WEST.toString(), Direction.WEST.getDisplayGetter()),
					new PrefOption(AppPreferences.TOOLBAR_DOWN_MIDDLE, Strings.getter("windowToolbarDownMiddle")),
					new PrefOption(AppPreferences.TOOLBAR_HIDDEN, Strings.getter("windowToolbarHidden")) });

	JPanel panel = new JPanel(new TableLayout(2));

	panel.add(toolbarPlacement.getJLabel());
	panel.add(toolbarPlacement.getJComboBox());

	setLayout(new TableLayout(1));
	for (int i = 0; i < checks.length; i++) {
		add(checks[i]);
	}
	add(panel);
}
 
Example 6
Project: marathonv5   File: DialogDemo.java   View Source Code Vote up 6 votes
/**
 * Used by createSimpleDialogBox and createFeatureDialogBox to create a pane
 * containing a description, a single column of radio buttons, and the Show
 * it! button.
 */
private JPanel createPane(String description, JRadioButton[] radioButtons, JButton showButton) {

    int numChoices = radioButtons.length;
    JPanel box = new JPanel();
    JLabel label = new JLabel(description);

    box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
    box.add(label);

    for (int i = 0; i < numChoices; i++) {
        box.add(radioButtons[i]);
    }

    JPanel pane = new JPanel(new BorderLayout());
    pane.add(box, BorderLayout.PAGE_START);
    pane.add(showButton, BorderLayout.PAGE_END);
    return pane;
}
 
Example 7
Project: Course-Management-System   File: CourseInfoPanel.java   View Source Code Vote up 5 votes
public CourseInfoPanel(String course_id) throws Exception{
	//setBackground(new Color(0, 0, 0));
	setLayout(new BorderLayout(0, 0));
	setPreferredSize(new Dimension(1300,600));
	JPanel panel = new JPanel();
	panel.setPreferredSize(new Dimension(1300,50));
	//panel.setForeground(new Color(255, 255, 255));
	//panel.setBackground(new Color(139, 0, 0));
	add(panel, BorderLayout.NORTH);
	JLabel lblCourseSummary = new JLabel("COURSE SUMMARY");
	lblCourseSummary.setFont(new Font("Verdana", Font.BOLD, 25));
	lblCourseSummary.setForeground(new Color(255, 255, 255));
	panel.add(lblCourseSummary);
	JPanel panel_1 = new JPanel();
	panel_1.setBackground(Color.WHITE);//If you want a different background comment this
	//panel_1.setPreferredSize(new Dimension(1300,400));
	coDao = new CourseDAO();
	co=coDao.getCourseById(course_id);
	//System.out.println("Course Selected or not:::" + co.getCourseInfo());
	panel_1.setPreferredSize(new Dimension(1290,500));
	JXLabel jl =new JXLabel("");
	try{
		//System.out.println("Inside the try catch block");
		if(co.getCourseInfo()!=null)
			jl.setText("\n\n"+co.getCourseInfo());
	}catch(Exception e){
		e.printStackTrace();
	}
	jl.setLineWrap(true);
	jl.setFont(new Font("Geneva", Font.BOLD, 16));
	panel_1.add(jl);
	add(panel_1,BorderLayout.CENTER);
}
 
Example 8
Project: QN-ACTR-Release   File: JabaWizard.java   View Source Code Vote up 5 votes
/**
 * @return the button panel
 */
@Override
protected JComponent makeButtons() {
	help = new HoverHelp();
	helpLabel = help.getHelpLabel();

	helpLabel.setBorder(BorderFactory.createEtchedBorder());
	//helpLabel.setHorizontalAlignment(SwingConstants.CENTER);

	ACTION_FINISH.putValue(Action.NAME, "Solve");
	ACTION_CANCEL.putValue(Action.NAME, "Exit");

	JPanel buttons = new JPanel();

	JButton button_finish = new JButton(ACTION_FINISH);
	help.addHelp(button_finish, "Validates the system and starts the solver");
	JButton button_cancel = new JButton(ACTION_CANCEL);
	help.addHelp(button_cancel, "Exits the wizard discarding all changes");
	JButton button_next = new JButton(ACTION_NEXT);
	help.addHelp(button_next, "Moves on to the next step");
	JButton button_previous = new JButton(ACTION_PREV);
	help.addHelp(button_previous, "Goes back to the previous step");
	JButton button_help = new JButton(ACTION_HELP);
	help.addHelp(button_help, "Displays help for the current panel");
	buttons.add(button_previous);
	buttons.add(button_next);
	buttons.add(button_finish);
	buttons.add(button_cancel);
	buttons.add(button_help);

	JPanel labelbox = new JPanel();
	labelbox.setLayout(new BorderLayout());
	labelbox.add(Box.createVerticalStrut(20), BorderLayout.WEST);
	labelbox.add(helpLabel, BorderLayout.CENTER);

	Box buttonBox = Box.createVerticalBox();
	buttonBox.add(buttons);
	buttonBox.add(labelbox);
	return buttonBox;
}
 
Example 9
Project: 20170612-NotaFIscalEletronica   File: FrameCadastroNf.java   View Source Code Vote up 5 votes
private void contrutorJanela(Evento evento){
	
	this.construtorTabelaModelItem();
	this.construtorPanelNf();
	this.construtorPanelEmitente();
	this.construtorPanelDestinatario();
	this.construtorPanelItem();
	this.contrutorPanelNff();
	this.construtorPanelControler(evento);
	

	JPanel cadastroPanel = new JPanel();
	cadastroPanel.setLayout(new BoxLayout(cadastroPanel, BoxLayout.Y_AXIS));
	cadastroPanel.add(new JLabel(" "));
	cadastroPanel.add(new JLabel(":::::NOTA FISCAL ELETRÔNICA:::::"));
	cadastroPanel.add(new JLabel(" "));
	cadastroPanel.add(cadastroPanelNf);
	cadastroPanel.add(cadastroPanelEmitente);
	cadastroPanel.add(cadastroPanelDestinatario);
	cadastroPanel.add(cadastroPanelItem);
	cadastroPanel.add(cadastroPanelNff);
	cadastroPanel.add(cadastroPanelControler);
	
	
	setLayout(new BorderLayout());
	add(cadastroPanel);
	setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	//cadastroFrame.setSize(500, 200);
	pack();
	setVisible(true);
	addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
				setEnabled(true);
		}
	});
	setEnabled(false);
}
 
Example 10
Project: openjdk-jdk10   File: TooMuchWheelRotationEventsTest.java   View Source Code Vote up 5 votes
private static JPanel createTestPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    JTextArea textArea = new JTextArea(20, 20);
    textArea.setText(getLongString());
    JScrollPane scrollPane = new JScrollPane(textArea);
    panel.add(scrollPane);
    return panel;
}
 
Example 11
Project: snake_classic   File: UserInterface0.java   View Source Code Vote up 5 votes
private void test_paneAddBackButton(JPanel panel){
	panel.setLayout(null);
	ButtonBack back = new ButtonBack("����");
	panel.add(back);
	back.setBounds(ConstantsTCS.getDemoUnique().getInt_windowWidth() - 100,
			0, 95, 50);
	back.addActionListener(event->{
		cardLayout.show(panelFirst, "id_menu");
	});
}
 
Example 12
Project: vexillo   File: ExportDialog.java   View Source Code Vote up 5 votes
private static JPanel makeRow(Object... cc) {
	JPanel p1 = new JPanel();
	p1.setLayout(new BoxLayout(p1, BoxLayout.LINE_AXIS));
	for (int i = 0; i < cc.length; i++) {
		if (i > 0) p1.add(Box.createHorizontalStrut(HGAP));
		if (cc[i] instanceof Component) p1.add((Component)cc[i]);
		else p1.add(new JLabel(cc[i].toString()));
	}
	JPanel p2 = new JPanel(new BorderLayout());
	p2.add(p1, BorderLayout.LINE_START);
	return p2;
}
 
Example 13
Project: ramus   File: CreateChartDialog.java   View Source Code Vote up 4 votes
public CreateChartDialog(GUIFramework framework, ChartsView chartsView) {
    super(framework.getMainFrame(), true);

    setTitle(ChartResourceManager.getString("Action.CreateChart"));
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    this.framework = framework;
    this.chartsView = chartsView;

    chartFramework = ChartGUIFramework.getFramework(framework);
    for (ChartPlugin chartPlugin : chartFramework.getChartPlugins()) {
        types.addItem(chartPlugin);
    }

    double[][] size = {
            {5, TableLayout.MINIMUM, TableLayout.FILL,
                    TableLayout.MINIMUM, TableLayout.FILL, 5},
            {5, TableLayout.FILL, 5}};

    TableLayout layout = new TableLayout(size);
    layout.setHGap(5);
    layout.setVGap(5);

    JPanel top = new JPanel(layout);

    top.add(new JLabel(ChartResourceManager.getString("Chart.type")),
            "1, 1");
    top.add(types, "2, 1");
    top.add(new JLabel(ChartResourceManager.getString("Chart.name")),
            "3, 1");
    top.add(name, "4, 1");

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(top, BorderLayout.NORTH);
    panel.add(centerPanel, BorderLayout.CENTER);
    setPlugin((ChartPlugin) types.getSelectedItem());
    types.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            setPlugin((ChartPlugin) types.getSelectedItem());
        }
    });
    setMinimumSize(new Dimension(600, 420));
    setMainPane(panel);
    pack();
    centerDialog();
    Options.loadOptions(this);
}
 
Example 14
Project: rapidminer   File: DataTableViewer.java   View Source Code Vote up 4 votes
public DataTableViewer(DataTable dataTable, LinkedHashMap<String, Class<? extends Plotter>> availablePlotters,
		boolean showPlotter, String tableMode, boolean autoResize) {
	super(new BorderLayout());

	// create empty buttonCard
	ButtonBarCardPanel bCard = new ButtonBarCardPanel();

	// Build table view
	this.dataTableViewerTable = new DataTableViewerTable(autoResize);
	this.tablePanel = new JPanel(new BorderLayout());
	JPanel infoPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
	infoPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 5));
	infoPanel.add(generalInfo);
	infoPanel.setOpaque(true);
	infoPanel.setBackground(Colors.WHITE);
	tablePanel.add(infoPanel, BorderLayout.NORTH);
	JScrollPane tableScrollPane = new ExtendedJScrollPane(dataTableViewerTable);
	tableScrollPane.setBorder(BorderFactory.createEmptyBorder(1, 10, 10, 5));
	tableScrollPane.setBackground(Colors.WHITE);
	tableScrollPane.getViewport().setBackground(Colors.WHITE);
	tablePanel.add(tableScrollPane, BorderLayout.CENTER);

	// add data table to the result view
	bCard.addCard(new ResourceCard("data_view", "result_view.data_view"), tablePanel);

	// Add plotters if desired
	if (showPlotter) {
		this.plotterSettings = new PlotterConfigurationModel(availablePlotters, dataTable);
		this.plotterPanel = new PlotterPanel(plotterSettings);
		DataTable plotData = plotterSettings.getDataTable();

		// preface to create ChartConfigationPanel:
		ExampleSet exampleSet = DataTableExampleSetAdapter.createExampleSetFromDataTable(plotData);
		Map<DatasetTransformationType, PlotConfiguration> plotConfigurationMap = PlotConfigurationHistory
				.getPlotConfigurationMap(exampleSet, plotData);
		PlotInstance plotInstance = new PlotInstance(plotConfigurationMap.get(DatasetTransformationType.ORIGINAL),
				plotData);
		this.advancedPanel = new ChartConfigurationPanel(true, plotInstance, plotData,
				plotConfigurationMap.get(DatasetTransformationType.DE_PIVOTED));

		// add Plotter to the result view
		bCard.addCard(new ResourceCard("plot_view", "result_view.plot_view"), plotterPanel);

		// add advanced Charts to the result view
		bCard.addCard(new ResourceCard("advanced_charts", "result_view.advanced_charts"), advancedPanel);
	} // end if (showPlotter)

	// check select desired view
	if (PLOT_MODE.equals(tableMode) && showPlotter) {
		bCard.selectCard("plot_view");
	} else if (ADVANCED_MODE.equals(tableMode) && showPlotter) {
		bCard.selectCard("advanced_charts");
	}

	add(bCard, BorderLayout.CENTER);
	setDataTable(dataTable);
}
 
Example 15
Project: rapidminer   File: IOObjectCacheViewer.java   View Source Code Vote up 4 votes
/** Updates the contents of the entries panel. */
private JPanel createEntriesPanel() {
	GridBagLayout layout = new GridBagLayout();

	GridBagConstraints gbc = new GridBagConstraints();
	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.weightx = 1.0;
	gbc.fill = GridBagConstraints.HORIZONTAL;

	JPanel entriesPanel = new JPanel();
	entriesPanel.setLayout(layout);

	List<String> keys = new ArrayList<>(map.getAll().keySet());
	Collections.sort(keys);
	boolean alternatingRow = true;
	for (String key : keys) {
		IOObject object = map.get(key);
		if (object == null) {
			// do not display empty results
			continue;
		}

		// look up icon
		Icon icon = RendererService.getIcon(object.getClass());
		if (icon == null) {
			icon = UNKNOWN_TYPE;
		}

		// look up name
		String type = RendererService.getName(object.getClass());
		if (type == null) {
			type = object.getClass().getSimpleName();
		}

		Action removeAction = new RemoveCacheEntryAction(map, key);
		Action openAction = new OpenCacheEntryAction(map, key);

		IOObjectCacheEntryPanel entry = new IOObjectCacheEntryPanel(icon, type, openAction, removeAction);
		if (alternatingRow) {
			entry.setDefaultBackground(Colors.WHITE);
		}
		alternatingRow = !alternatingRow;

		entriesPanel.add(entry, gbc);
		gbc.gridy += 1;
	}

	gbc.weighty = 1.0;
	gbc.fill = GridBagConstraints.BOTH;
	entriesPanel.add(Box.createVerticalGlue(), gbc);

	return entriesPanel;
}
 
Example 16
Project: incubator-netbeans   File: BookmarkKeyChooser.java   View Source Code Vote up 4 votes
public void show(Component parent, Runnable runOnClose) {
    this.runOnClose = runOnClose;
    key2bookmark = new HashMap<Character, BookmarkInfo>(2 * 46, 0.5f);
    BookmarkManager lockedBookmarkManager = BookmarkManager.getLocked();
    try {
        // Open projects should have their bookmarks loaded before invocation of this method
        // so that it's possible to enumerate present keys properly
        for (ProjectBookmarks projectBookmarks : lockedBookmarkManager.activeProjectBookmarks()) {
            for (FileBookmarks fileBookmarks : projectBookmarks.getFileBookmarks()) {
                for (BookmarkInfo bookmark : fileBookmarks.getBookmarks()) {
                    String key = bookmark.getKey();
                    if (key != null && key.length() > 0) {
                        key2bookmark.put(key.charAt(0), bookmark);
                    }
                }
            }
        }
    } finally {
        lockedBookmarkManager.unlock();
    }
    
    JPanel cellPanel = new JPanel();
    if (key2bookmark.size() > 0) {
        cellPanel.setLayout(new GridLayout(4, 10, 2, 2));
        addCells(cellPanel, 10 * 4, '1', '9', '0', '0', 'A', 'Z');
    } else { // No bookmarks with keys
        cellPanel.setLayout(new GridLayout(2, 1, 2, 2));
        JLabel noKeysLabel = new JLabel(NbBundle.getMessage(BookmarkKeyChooser.class, "LBL_keyChooserNoActiveKeys"), JLabel.CENTER);
        JLabel noKeysHelpLabel = new JLabel(NbBundle.getMessage(BookmarkKeyChooser.class, "LBL_keyChooserNoActiveKeysHelp"), JLabel.CENTER);
        cellPanel.add(noKeysLabel);
        cellPanel.add(noKeysHelpLabel);
    }
    cellPanel.setBorder(new EmptyBorder(4, 4, 4, 4));
    closeButton = new JButton(NbBundle.getMessage(BookmarkKeyChooser.class, "CTL_keyChooserCloseButton")); // NOI18N

    dialog = org.netbeans.editor.DialogSupport.createDialog(
            NbBundle.getMessage(BookmarkKeyChooser.class, "CTL_keyChooserTitle"), // NOI18N
            cellPanel, true, // modal
            new JButton[] { closeButton }, false, // bottom buttons
            0, // defaultIndex = 0 => allow close by Enter key too
            0, // cancelIndex
            this // ActionListener
    );
    dialog.pack();
    
    Point parentMidPoint = new Point(parent.getWidth() / 2, parent.getHeight() / 2);
    SwingUtilities.convertPointToScreen(parentMidPoint, parent);
    dialog.setBounds(
            parentMidPoint.x - dialog.getWidth() / 2,
            parentMidPoint.y - dialog.getHeight() / 2,
            dialog.getWidth(),
            dialog.getHeight()
    );
    closeButton.addKeyListener(this);
    dialog.setAlwaysOnTop(true);
    dialog.setVisible(true);
}
 
Example 17
Project: incubator-netbeans   File: VCSCommitPanel.java   View Source Code Vote up 4 votes
/**
 * This method is called from within the constructor to initialize the form.
 */
// <editor-fold defaultstate="collapsed" desc="UI Layout Code">
private void initComponents(Collection<? extends VCSHook> hooks, VCSHookContext hooksContext) {
    org.openide.awt.Mnemonics.setLocalizedText(commitButton, modifier.getMessage(VCSCommitPanelModifier.BundleMessage.COMMIT_BUTTON_LABEL));
    commitButton.getAccessibleContext().setAccessibleName(modifier.getMessage(VCSCommitPanelModifier.BundleMessage.COMMIT_BUTTON_ACCESSIBLE_NAME));
    commitButton.getAccessibleContext().setAccessibleDescription(modifier.getMessage(VCSCommitPanelModifier.BundleMessage.COMMIT_BUTTON_ACCESSIBLE_DESCRIPTION));
    
    org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(VCSCommitPanel.class, "CTL_Commit_Action_Cancel")); //NOI18N
    cancelButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(VCSCommitPanel.class, "ACSN_Commit_Action_Cancel")); //NOI18N
    cancelButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(VCSCommitPanel.class, "ACSD_Commit_Action_Cancel"));//NOI18N
    
    getAccessibleContext().setAccessibleName(modifier.getMessage(VCSCommitPanelModifier.BundleMessage.PANEL_ACCESSIBLE_NAME));
    getAccessibleContext().setAccessibleDescription(modifier.getMessage(VCSCommitPanelModifier.BundleMessage.PANEL_ACCESSIBLE_DESCRIPTION));
    
    basePanel.setBorder(createEmptyBorder(10,             // top
                                getContainerGap(WEST),    // left
                                0,                        // bottom
                                getContainerGap(EAST)));  // right
    
    basePanel.setLayout(new BoxLayout(basePanel, Y_AXIS));
    
    // parameters panel -> holds all commit parameters specific 
    // for the given VCS system - message, switches, etc.
    parametersPane1.setLayout(new BorderLayout());
    parametersPane1.add(parameters.getPanel());                
    parametersPane1.setAlignmentX(LEFT_ALIGNMENT);        
    basePanel.add(parametersPane1);
    
    // files table        
    FilesPanel filesPanel = new FilesPanel(this, filters, parameters.getPanel().getPreferredSize().height);
    basePanel.add(makeVerticalStrut(parametersPane1, filesPanel, RELATED, this));        
    basePanel.add(filesPanel);
    
    // hooks area
    int hooksWidth = -1;
    if(!hooks.isEmpty()) {
        HookPanel hooksPanel = new HookPanel(this, hooks, hooksContext);
        hooksPanel.setAlignmentX(LEFT_ALIGNMENT);
        basePanel.add(hooksPanel);
        basePanel.add(makeVerticalStrut(hooksPanel, errorLabel, RELATED, this));
        hooksWidth = hooksPanel.getPreferedWidth();
    } else {
        basePanel.add(makeVerticalStrut(filesPanel, errorLabel, RELATED, this));            
    }
    
    // bottom panel -> error label, progres, ...
    JPanel bottomPanel = new VerticallyNonResizingPanel();
    bottomPanel.setLayout(new BoxLayout(bottomPanel, Y_AXIS));
    bottomPanel.add(progressPanel);
    bottomPanel.add(errorLabel);
    errorLabel.setAlignmentY(CENTER_ALIGNMENT);                
    errorLabel.setText("");
    errorLabel.setVisible(false);
    errorLabel.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/versioning/util/resources/error.gif", false)); // NOI18N        
    
    progressPanel.setAlignmentY(LEFT_ALIGNMENT);        
    bottomPanel.setAlignmentX(LEFT_ALIGNMENT);
    bottomPanel.setBorder(createEmptyBorder(10,           // top
                                getContainerGap(WEST),    // left
                                0,                        // bottom
                                getContainerGap(EAST)));  // right
    
    basePanel.add(bottomPanel);
    
    int baseWidth = basePanel.getPreferredSize().width;
    int baseHeight = basePanel.getPreferredSize().height;
    int parametersWidth = parametersPane1.getPreferredSize().width;
    
    if(baseWidth < parametersWidth) baseWidth = parametersWidth;
    if(baseWidth < hooksWidth) baseWidth = hooksWidth;
    basePanel.setPreferredSize(new Dimension(baseWidth, baseHeight));
    
    setLayout(new BoxLayout(this, Y_AXIS));
    add(basePanel);  
    
    
}
 
Example 18
Project: rapidminer   File: LicenseUpgradeDialog.java   View Source Code Vote up 4 votes
protected JPanel makeButtonPanel() {
    JPanel buttonPanel = new JPanel(new FlowLayout(2, 6, 6));
    buttonPanel.add(this.makeContinueButton());
    buttonPanel.add(this.makeUpgradeButton());
    return buttonPanel;
}
 
Example 19
Project: chordatlas   File: Tweed.java   View Source Code Vote up 4 votes
public void addUI( JPanel panel ) {

		panel.setLayout( new ListDownLayout() );
		ButtonGroup bg = new ButtonGroup();

		panel.add( new JLabel("tools:") );
		
		for ( Tool t : tools ) {

			JToggleButton tb = new JToggleButton( t.getName() );
			bg.add( tb );

			tb.addActionListener( new ActionListener() {

				@Override
				public void actionPerformed( ActionEvent e ) {
					Tweed.this.setTool( t );
				}
			} );

			panel.add( tb );
		}
		
		((JToggleButton)panel.getComponent( 1 ) ).setSelected( true );

	}
 
Example 20
Project: javaportfolio   File: TransactionPane.java   View Source Code Vote up 2 votes
public TransactionPane(Portfolio portfolio) {
	super(new BorderLayout());

	this.portfolio = portfolio;

	// Stocks
	names = portfolio.getTransactionTickers("kaikki","kaikki"); 
	
	transactionStocksList = new JComboBox(names);
	transactionStocksList.setActionCommand("name");
	
	
	// years
	String[] years = portfolio.getTransactionYears(null);
	JComboBox yearList = new JComboBox(years);
	yearList.setActionCommand("year");


	// Brokers
	Object[] brokerNames = portfolio.getBrokers();
	brokerList = new BrokerList(brokerNames, this);
	
	// Transaction types
	JComboBox transactionNameList = new JComboBox(transactionNames);
	transactionNameList.setActionCommand("transaction");
	transactionNameList.setSelectedIndex(0);
	selectedTransaction = transactionNames[0];
	

	
	// Lay out

	FlowLayout flowLayout = new FlowLayout();

	top = new JPanel(flowLayout);
	top.add(new JLabel("Vuosi: "));
	top.add(yearList);

	top.add(new JLabel("AO-tili: "));
	top.add(brokerList.getBrokerList());

	top.add(new JLabel("Tapahtuma: "));
	top.add(transactionNameList);
	
	top.add(new JLabel("Nimi: "));
	top.add(transactionStocksList);
	
	add(top, BorderLayout.PAGE_START);

	// Create the scroll pane and add the table to it.
	scrollPane = new JScrollPane(table);

	// Add the scroll pane to this panel.
	add(scrollPane);

	
	
	if (years.length > 0) {

		selectedYear = years[years.length - 1];
		yearList.setSelectedIndex(years.length - 1);
		
		update();
	}
	yearList.addActionListener(this);
	transactionNameList.addActionListener(this);
	transactionStocksList.addActionListener(this);
}