Java Code Examples for javax.swing.JPanel#setAlignmentX()

The following examples show how to use javax.swing.JPanel#setAlignmentX() . 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: GUIOptionHttp.java    From PacketProxy with Apache License 2.0 5 votes vote down vote up
public JPanel createPanel() throws Exception {
	JPanel panel = new JPanel();
	panel.setBackground(Color.WHITE);
	panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
	panel.add(combo);
	panel.add(new JLabel(I18nString.get("has a high priority")));
	panel.setAlignmentX(Component.LEFT_ALIGNMENT);
	panel.setMaximumSize(new Dimension(Short.MAX_VALUE, panel.getMaximumSize().height));
	return panel;
}
 
Example 2
Source File: AqlViewer.java    From CQL with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public Unit visit(String k, JTabbedPane pane, ApgTypeside t) throws RuntimeException {

	Object[][] rowData = new Object[t.Bs.size()][3];
	Object[] colNames = new Object[2];
	colNames[0] = "Base Type";
	colNames[1] = "Java Class";
	int j = 0;
	for (Entry<String, Pair<Class<?>, java.util.function.Function<String, Object>>> lt : t.Bs.entrySet()) {
		rowData[j][0] = lt.getKey();
		rowData[j][1] = lt.getValue().first.getName();
	 	j++;
	}
	JPanel x = GuiUtil.makeTable(BorderFactory.createEmptyBorder(), null, rowData, colNames);

	JPanel c = new JPanel();
	c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS));

	x.setAlignmentX(Component.LEFT_ALIGNMENT);
	x.setMinimumSize(x.getPreferredSize());
	c.add(x);
	
	JPanel p = new JPanel(new GridLayout(1, 1));
	p.add(c);
	JScrollPane jsp = new JScrollPane(p);

	c.setBorder(BorderFactory.createEmptyBorder());
	p.setBorder(BorderFactory.createEmptyBorder());
	jsp.setBorder(BorderFactory.createEmptyBorder());
	
	pane.addTab("Table", p);
	
	return Unit.unit;
}
 
Example 3
Source File: MBeansPanel.java    From javamelody with Apache License 2.0 5 votes vote down vote up
private JScrollPane createScrollPane() {
	final JScrollPane scrollPane = new JScrollPane();
	final JPanel panel = new JPanel();
	panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
	panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
	scrollPane.setViewportView(panel);
	scrollPane.getVerticalScrollBar().setUnitIncrement(20);
	// cette récupération du focus dans le panel du scrollPane permet d'utiliser les flèches hauts et bas
	// pour scroller dès l'affichage du panel
	SwingUtilities.invokeLater(new Runnable() {
		@Override
		public void run() {
			panel.requestFocus();
		}
	});

	panel.setOpaque(false);
	for (final Map.Entry<String, List<MBeanNode>> entry : mbeansByTitle.entrySet()) {
		final String title;
		if (mbeansByTitle.size() == 1) {
			title = getString("MBeans");
		} else {
			title = entry.getKey();
		}
		final List<MBeanNode> mbeans = entry.getValue();
		final JLabel titleLabel = Utilities.createParagraphTitle(title, "mbeans.png");
		titleLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
		panel.add(titleLabel);

		final JPanel treePanel = createDomainTreePanel(mbeans);
		treePanel.setAlignmentX(Component.LEFT_ALIGNMENT);
		treePanel.setBorder(MBeanNodePanel.LEFT_MARGIN_BORDER);
		panel.add(treePanel);
	}
	return scrollPane;
}
 
Example 4
Source File: MeasurementSetPanel.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/** Creates new form MeasurementSetPanel */
public MeasurementSetPanel(ScaleToolModel scaleToolModel) {
   this.scaleToolModel = scaleToolModel;

   initComponents();

   measurementSetScrollPane = new MeasurementSetScrollPane(scaleToolModel);

   // Title
   JPanel title = MeasurementSetScrollPane.getTitleLabel();
   title.setAlignmentX(0);
   measurementSetScrollPane.setAlignmentX(0);
   measurementSetWithTitlePanel.add(title);
   measurementSetWithTitlePanel.add(measurementSetScrollPane);
}
 
Example 5
Source File: LegendBuilder.java    From geomajas-project-server with GNU Affero General Public License v3.0 5 votes vote down vote up
public void addLayer(String title, Font font, RenderedImage image) {
	JPanel panel = new JPanel();
	panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
	RenderedImageIcon icon = new RenderedImageIcon(image,
			LegendGraphicMetadata.DEFAULT_WIDTH, LegendGraphicMetadata.DEFAULT_HEIGHT);
	JLabel label = new JLabel(icon);
	label.setBorder(new EmptyBorder(ICON_PADDING, ICON_PADDING, ICON_PADDING, ICON_PADDING));
	panel.add(label);
	panel.add(Box.createRigidArea(new Dimension(MEMBER_MARGIN, 0)));
	JLabel itemText = new JLabel(title);
	itemText.setFont(font);
	panel.add(itemText);
	panel.setAlignmentX(JPanel.LEFT_ALIGNMENT);
	legendPanel.add(panel);
}
 
Example 6
Source File: InterpolateFilter.java    From GpsPrune with GNU General Public License v2.0 5 votes vote down vote up
/** Make the panel contents */
protected void makePanelContents()
{
	setLayout(new BorderLayout());
	JPanel boxPanel = new JPanel();
	boxPanel.setLayout(new BoxLayout(boxPanel, BoxLayout.Y_AXIS));
	add(boxPanel, BorderLayout.NORTH);
	JLabel topLabel = new JLabel(I18nManager.getText("dialog.gpsbabel.filter.interpolate.intro"));
	topLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
	boxPanel.add(topLabel);
	boxPanel.add(Box.createVerticalStrut(18)); // spacer
	// Main three-column grid
	JPanel gridPanel = new JPanel();
	gridPanel.setLayout(new GridLayout(0, 3, 4, 4));
	gridPanel.add(new JLabel(I18nManager.getText("dialog.gpsbabel.filter.interpolate.distance")));
	_distField = new DecimalNumberField();
	_distField.addKeyListener(_paramChangeListener);
	gridPanel.add(_distField);
	_distUnitsCombo = new JComboBox<String>(new String[] {I18nManager.getText("units.kilometres"), I18nManager.getText("units.miles")});
	gridPanel.add(_distUnitsCombo);
	gridPanel.add(new JLabel(I18nManager.getText("dialog.gpsbabel.filter.interpolate.time")));
	_secondsField = new WholeNumberField(4);
	_secondsField.addKeyListener(_paramChangeListener);
	gridPanel.add(_secondsField);
	gridPanel.add(new JLabel(I18nManager.getText("units.seconds")));
	gridPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
	boxPanel.add(gridPanel);
}
 
Example 7
Source File: MainFrame.java    From FCMFrame with Apache License 2.0 5 votes vote down vote up
public static void createHorizonalHintBox(JPanel parent, JComponent c, JLabel l1) {
	parent.setAlignmentX(Component.LEFT_ALIGNMENT);
	parent.setBounds(15, 10, 100, 30);
	c.setAlignmentX(Component.LEFT_ALIGNMENT);
	
	l1.setAlignmentX(Component.LEFT_ALIGNMENT);
	parent.add(l1);
}
 
Example 8
Source File: MapListCellRenderer.java    From settlers-remake with MIT License 5 votes vote down vote up
/**
 * Constructor
 */
public MapListCellRenderer() {
	JPanel pFirst = new JPanel();
	pFirst.setOpaque(false);
	pFirst.setLayout(new BorderLayout(5, 0));
	pFirst.add(mapNameLabel, BorderLayout.CENTER);
	pFirst.add(playerCountLabel, BorderLayout.EAST);
	pFirst.setAlignmentX(Component.LEFT_ALIGNMENT);
	rightPanelPart.add(pFirst);
	rightPanelPart.add(mapIdLabel);
	mapIdLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
	rightPanelPart.add(descriptionLabel);
	descriptionLabel.setAlignmentX(Component.LEFT_ALIGNMENT);

	rightPanelPart.setOpaque(false);
	rightPanelPart.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
	mapNameLabel.setFont(mapNameLabel.getFont().deriveFont(Font.BOLD));
	mapNameLabel.setAlignmentX(Component.LEFT_ALIGNMENT);

	mapNameLabel.setForeground(FOREGROUND);
	mapIdLabel.setForeground(FOREGROUND);
	descriptionLabel.setForeground(FOREGROUND);
	playerCountLabel.setForeground(Color.BLUE);

	contentsPanel.setLayout(new BorderLayout());
	contentsPanel.add(rightPanelPart, BorderLayout.CENTER);
	contentsPanel.add(iconLabel, BorderLayout.WEST);
	contentsPanel.putClientProperty(ELFStyle.KEY, ELFStyle.PANEL_DRAW_BG_CUSTOM);

	iconLabel.setOpaque(false);
	iconLabel.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));

	// Update UI
	SwingUtilities.updateComponentTreeUI(contentsPanel);
}
 
Example 9
Source File: TomatoLinearClassifierDemo.java    From COMP3204 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private JPanel createColourSpaceButtons() {
	final JPanel colourspacesPanel = new JPanel();
	colourspacesPanel.setOpaque(false);
	colourspacesPanel.setLayout(new BoxLayout(colourspacesPanel, BoxLayout.X_AXIS));
	colourspacesPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
	final ButtonGroup group = new ButtonGroup();
	createRadioButton(colourspacesPanel, group, ColourSpace.HUE);
	createRadioButton(colourspacesPanel, group, ColourSpace.HS);
	createRadioButton(colourspacesPanel, group, ColourSpace.H1H2);
	return colourspacesPanel;
}
 
Example 10
Source File: ControlPanel.java    From gepard with MIT License 4 votes vote down vote up
public ControlPanel(Controller ictrl) {

		// store controller
		ctrl = ictrl;

		// load substitution matrices from XML file
		try {
			substMatrices = SubstMatrixList.getInstance().getMatrixFiles();
		} catch (Exception e) {
			ClientGlobals.errMessage("Could not open substitution matrix list. " + "The 'matrices/' subfolder seems to be corrupted");
			System.exit(1);
		}

		// sequences panel
		JPanel localTab = generateLocalTab();

		seqTabs = new JTabbedPane();
		// add sequence panes
		seqTabs.addTab("Sequences", localTab);
		seqTabs.addChangeListener(this);

		// function panel
		JPanel functPanel = generateFunctionPanel();

		// options panel
		JPanel plotOptTab = generatePlotOptTab();
		JPanel miscTab = generateMiscTab();
		dispTab = generateDispTab();

		optTabs = new JTabbedPane();
		optTabs.setFont(MAIN_FONT);
		// optTabs.setBorder(BorderFactory.createEmptyBorder());
		optTabs.addTab("Plot", plotOptTab);
		optTabs.addTab("Misc", miscTab);
		optTabs.addTab("Display", dispTab);
		optTabs.setSelectedIndex(0);

		// create layout
		seqTabs.setAlignmentX(Component.LEFT_ALIGNMENT);
		optTabs.setAlignmentX(Component.LEFT_ALIGNMENT);
		btnGo.setAlignmentX(Component.LEFT_ALIGNMENT);
		functPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
		JPanel fixedBox = new JPanel();
		fixedBox.setLayout(new BoxLayout(fixedBox, BoxLayout.Y_AXIS));
		// fixedBox.setLayout(new GridBagLayout());
		fixedBox.add(Box.createRigidArea(new Dimension(0, 3)));
		fixedBox.add(seqTabs);
		fixedBox.add(Box.createRigidArea(new Dimension(0, 10)));
		fixedBox.add(functPanel);
		// fixedBox.add(Box.createRigidArea(new Dimension(0,10)));

		fixedBox.add(Box.createRigidArea(new Dimension(0, 10)));
		fixedBox.add(optTabs);

		seqTabs.setPreferredSize(new Dimension(1, SEQ_HEIGHT));
		functPanel.setPreferredSize(new Dimension(1, FUNCT_HEIGHT));
		optTabs.setPreferredSize(new Dimension(1, OPT_HEIGHT));

		// dummy panel which pushes the go button to the bottom of the window
		JPanel panelQuit = new JPanel(new GridBagLayout());
		GridBagConstraints c = new GridBagConstraints();
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 0;
		c.gridy = 0;
		c.weightx = 1;
		c.weighty = 1000;
		panelQuit.add(new JLabel(""), c);
		c.gridy++;
		c.weighty = 1;
		c.insets = new Insets(0, HOR_MARGIN + QUIT_BTN_HOR_MARGIN, BELOW_QUIT_BTN, HOR_MARGIN + QUIT_BTN_HOR_MARGIN);
		panelQuit.add(btnQuit = new JButton("Quit"), c);

		btnQuit.setPreferredSize(new Dimension(1, QUIT_BTN_HEIGHT));

		setLayout(new BorderLayout());
		add(fixedBox, BorderLayout.NORTH);
		add(panelQuit, BorderLayout.CENTER);

		btnQuit.addActionListener(this);

		// simple or advanced mode
		if (Config.getInstance().getIntVal("advanced", 0) == 1)
			switchMode(true);
		else
			switchMode(false);

		// help tooltips
		btnQuit.setToolTipText(HelpTexts.getInstance().getHelpText("quit"));

		// set initial parameters
		needreload = true;

		setDispTabEnabled(false);
		setNavigationEnabled(false);

	}
 
Example 11
Source File: RuleSelectFrame.java    From nullpomino with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * GUIAInitialization
 */
protected void initUI() {
	this.getContentPane().setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));

	// Tab
	tabPane = new JTabbedPane();
	tabPane.setAlignmentX(LEFT_ALIGNMENT);
	this.add(tabPane);

	// Rules
	listboxRule = new JList[GameEngine.MAX_GAMESTYLE];
	for(int i = 0; i < GameEngine.MAX_GAMESTYLE; i++) {
		listboxRule[i] = new JList(extractRuleListFromRuleEntries(i));
		JScrollPane scpaneRule = new JScrollPane(listboxRule[i]);
		scpaneRule.setPreferredSize(new Dimension(380, 250));
		scpaneRule.setAlignmentX(LEFT_ALIGNMENT);
		tabPane.addTab(GameEngine.GAMESTYLE_NAMES[i], scpaneRule);
	}

	//  default Back to button
	JButton btnUseDefault = new JButton(NullpoMinoSwing.getUIText("RuleSelect_UseDefault"));
	btnUseDefault.setMnemonic('D');
	btnUseDefault.addActionListener(this);
	btnUseDefault.setActionCommand("RuleSelect_UseDefault");
	btnUseDefault.setAlignmentX(LEFT_ALIGNMENT);
	btnUseDefault.setMaximumSize(new Dimension(Short.MAX_VALUE, 30));
	btnUseDefault.setVisible(false);
	this.add(btnUseDefault);

	//  buttonKind
	JPanel pButtons = new JPanel();
	pButtons.setLayout(new BoxLayout(pButtons, BoxLayout.X_AXIS));
	pButtons.setAlignmentX(LEFT_ALIGNMENT);
	this.add(pButtons);

	JButton btnOK = new JButton(NullpoMinoSwing.getUIText("RuleSelect_OK"));
	btnOK.setMnemonic('O');
	btnOK.addActionListener(this);
	btnOK.setActionCommand("RuleSelect_OK");
	btnOK.setAlignmentX(LEFT_ALIGNMENT);
	btnOK.setMaximumSize(new Dimension(Short.MAX_VALUE, 30));
	pButtons.add(btnOK);
	this.getRootPane().setDefaultButton(btnOK);

	JButton btnCancel = new JButton(NullpoMinoSwing.getUIText("RuleSelect_Cancel"));
	btnCancel.setMnemonic('C');
	btnCancel.addActionListener(this);
	btnCancel.setActionCommand("RuleSelect_Cancel");
	btnCancel.setAlignmentX(LEFT_ALIGNMENT);
	btnCancel.setMaximumSize(new Dimension(Short.MAX_VALUE, 30));
	pButtons.add(btnCancel);
}
 
Example 12
Source File: UnitScroller.java    From triplea with GNU General Public License v3.0 4 votes vote down vote up
/** Constructs a UI component for the UnitScroller. */
public Component build() {
  final JPanel panel = new JPanel();
  collapsiblePanel = new CollapsiblePanel(panel, "");
  updateMovesLeft();

  panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

  panel.add(selectUnitImagePanel);
  panel.add(territoryNameLabel);
  panel.add(Box.createVerticalStrut(2));

  final JButton prevUnit = new JButton(UnitScrollerIcon.LEFT_ARROW.get());
  prevUnit.setToolTipText(PREVIOUS_UNITS_TOOLTIP);
  prevUnit.setAlignmentX(JComponent.CENTER_ALIGNMENT);
  prevUnit.addActionListener(e -> centerOnPreviousMovableUnit());

  final JButton sleepButton = new JButton(UnitScrollerIcon.SLEEP.get());
  sleepButton.setToolTipText(SLEEP_UNITS_TOOLTIP);
  sleepButton.addActionListener(e -> sleepCurrentUnits());

  final JButton skipButton = new JButton(UnitScrollerIcon.SKIP.get());
  skipButton.setToolTipText(SKIP_UNITS_TOOLTIP);
  skipButton.addActionListener(e -> skipCurrentUnits());

  final JButton wakeAllButton = new JButton(UnitScrollerIcon.WAKE_ALL.get());
  wakeAllButton.setToolTipText(WAKE_ALL_TOOLTIP);
  wakeAllButton.addActionListener(e -> wakeAllUnits());
  wakeAllButton.setFocusable(false);

  final JButton nextUnit = new JButton(UnitScrollerIcon.RIGHT_ARROW.get());
  nextUnit.setToolTipText(NEXT_UNITS_TOOLTIP);
  nextUnit.addActionListener(e -> centerOnNextMovableUnit());

  final JPanel skipAndSleepPanel =
      new JPanelBuilder()
          .boxLayoutHorizontal()
          .add(prevUnit)
          .addHorizontalStrut(HORIZONTAL_BUTTON_GAP)
          .add(wakeAllButton)
          .addHorizontalStrut(HORIZONTAL_BUTTON_GAP)
          .add(sleepButton)
          .addHorizontalStrut(HORIZONTAL_BUTTON_GAP)
          .add(skipButton)
          .addHorizontalStrut(HORIZONTAL_BUTTON_GAP)
          .add(nextUnit)
          .build();
  skipAndSleepPanel.setAlignmentX(JComponent.CENTER_ALIGNMENT);

  panel.add(skipAndSleepPanel, BorderLayout.SOUTH);
  panel.add(Box.createVerticalStrut(3));
  return collapsiblePanel;
}
 
Example 13
Source File: NetAdmin.java    From nullpomino with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Init login screen
 */
private void initLoginUI() {
	// Main panel
	JPanel mpLoginOwner = new JPanel(new BorderLayout());
	this.getContentPane().add(mpLoginOwner, SCREENCARD_NAMES[SCREENCARD_LOGIN]);
	JPanel mpLogin = new JPanel();
	mpLogin.setLayout(new BoxLayout(mpLogin, BoxLayout.Y_AXIS));
	mpLoginOwner.add(mpLogin, BorderLayout.NORTH);

	// * Login Message label
	labelLoginMessage = new JLabel(getUIText("Login_Message_Default"));
	labelLoginMessage.setAlignmentX(0f);
	mpLogin.add(labelLoginMessage);

	// * Server panel
	JPanel spServer = new JPanel(new BorderLayout());
	spServer.setAlignmentX(0f);
	mpLogin.add(spServer);

	// ** Server label
	JLabel lServer = new JLabel(getUIText("Login_Server"));
	spServer.add(lServer, BorderLayout.WEST);

	// ** Server textbox
	txtfldServer = new JTextField(30);
	txtfldServer.setText(propConfig.getProperty("login.server", ""));
	txtfldServer.setComponentPopupMenu(new TextComponentPopupMenu(txtfldServer));
	spServer.add(txtfldServer, BorderLayout.EAST);

	// * Username panel
	JPanel spUsername = new JPanel(new BorderLayout());
	spUsername.setAlignmentX(0f);
	mpLogin.add(spUsername);

	// ** Username label
	JLabel lUsername = new JLabel(getUIText("Login_Username"));
	spUsername.add(lUsername, BorderLayout.WEST);

	// ** Username textbox
	txtfldUsername = new JTextField(30);
	txtfldUsername.setText(propConfig.getProperty("login.username", ""));
	txtfldUsername.setComponentPopupMenu(new TextComponentPopupMenu(txtfldUsername));
	spUsername.add(txtfldUsername, BorderLayout.EAST);

	// * Password panel
	JPanel spPassword = new JPanel(new BorderLayout());
	spPassword.setAlignmentX(0f);
	mpLogin.add(spPassword);

	// ** Password label
	JLabel lPassword = new JLabel(getUIText("Login_Password"));
	spPassword.add(lPassword, BorderLayout.WEST);

	// ** Password textbox
	passfldPassword = new JPasswordField(30);
	String strPassword = propConfig.getProperty("login.password", "");
	if(strPassword.length() > 0) {
		passfldPassword.setText(NetUtil.decompressString(strPassword));
	}
	passfldPassword.setComponentPopupMenu(new TextComponentPopupMenu(passfldPassword));
	spPassword.add(passfldPassword, BorderLayout.EAST);

	// * Remember Username checkbox
	chkboxRememberUsername = new JCheckBox(getUIText("Login_RememberUsername"));
	chkboxRememberUsername.setSelected(propConfig.getProperty("login.rememberUsername", false));
	chkboxRememberUsername.setAlignmentX(0f);
	mpLogin.add(chkboxRememberUsername);

	// * Remember Password checkbox
	chkboxRememberPassword = new JCheckBox(getUIText("Login_RememberPassword"));
	chkboxRememberPassword.setSelected(propConfig.getProperty("login.rememberPassword", false));
	chkboxRememberPassword.setAlignmentX(0f);
	mpLogin.add(chkboxRememberPassword);

	// * Buttons panel
	JPanel spButtons = new JPanel();
	spButtons.setLayout(new BoxLayout(spButtons, BoxLayout.X_AXIS));
	spButtons.setAlignmentX(0f);
	mpLogin.add(spButtons);

	// ** Login button
	btnLogin = new JButton(getUIText("Login_Login"));
	btnLogin.setMnemonic('L');
	btnLogin.setMaximumSize(new Dimension(Short.MAX_VALUE, btnLogin.getMaximumSize().height));
	btnLogin.setActionCommand("Login_Login");
	btnLogin.addActionListener(this);
	spButtons.add(btnLogin);

	// ** Quit button
	JButton btnQuit = new JButton(getUIText("Login_Quit"));
	btnQuit.setMnemonic('Q');
	btnQuit.setMaximumSize(new Dimension(Short.MAX_VALUE, btnQuit.getMaximumSize().height));
	btnQuit.setActionCommand("Login_Quit");
	btnQuit.addActionListener(this);
	spButtons.add(btnQuit);
}
 
Example 14
Source File: SimplifyFilter.java    From GpsPrune with GNU General Public License v2.0 4 votes vote down vote up
/** Make the panel contents */
protected void makePanelContents()
{
	setLayout(new BorderLayout());
	JPanel boxPanel = new JPanel();
	boxPanel.setLayout(new BoxLayout(boxPanel, BoxLayout.Y_AXIS));
	add(boxPanel, BorderLayout.NORTH);
	JLabel topLabel = new JLabel(I18nManager.getText("dialog.gpsbabel.filter.simplify.intro"));
	topLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
	boxPanel.add(topLabel);
	boxPanel.add(Box.createVerticalStrut(18)); // spacer
	// Main three-column grid
	JPanel gridPanel = new JPanel();
	gridPanel.setLayout(new GridLayout(0, 3, 4, 4));
	gridPanel.add(new JLabel(I18nManager.getText("dialog.gpsbabel.filter.simplify.maxpoints")));
	_maxPointsField = new WholeNumberField(6);
	_maxPointsField.addKeyListener(_paramChangeListener);
	gridPanel.add(_maxPointsField);
	gridPanel.add(new JLabel(" "));
	gridPanel.add(new JLabel(I18nManager.getText("dialog.gpsbabel.filter.simplify.maxerror")));
	_distField = new DecimalNumberField();
	_distField.addKeyListener(_paramChangeListener);
	gridPanel.add(_distField);
	_distUnitsCombo = new JComboBox<String>(new String[] {
		I18nManager.getText(UnitSetLibrary.UNITS_KILOMETRES.getNameKey()),
		I18nManager.getText(UnitSetLibrary.UNITS_MILES.getNameKey())
	});
	gridPanel.add(_distUnitsCombo);
	// radio buttons
	_crossTrackRadio = new JRadioButton(I18nManager.getText("dialog.gpsbabel.filter.simplify.crosstrack"));
	_crossTrackRadio.setSelected(true);
	_lengthRadio     = new JRadioButton(I18nManager.getText("dialog.gpsbabel.filter.simplify.length"));
	_relativeRadio   = new JRadioButton(I18nManager.getText("dialog.gpsbabel.filter.simplify.relative"));
	ButtonGroup radioGroup = new ButtonGroup();
	radioGroup.add(_crossTrackRadio);
	radioGroup.add(_lengthRadio);
	radioGroup.add(_relativeRadio);
	gridPanel.add(_crossTrackRadio);
	gridPanel.add(_lengthRadio);
	gridPanel.add(_relativeRadio);
	gridPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
	boxPanel.add(gridPanel);
}
 
Example 15
Source File: ModelTreeRTStats.java    From mts with GNU General Public License v3.0 4 votes vote down vote up
synchronized public void displayCounters(StatKey prefixKey, javax.swing.JPanel panel) throws Exception {
    // We clear the panel
    panel.removeAll();

    // We generate the railWay in relartion with th StatKey displayed
    generateRailWay(prefixKey);

    // We get all template possible for the StatKey prefixKey
    List<CounterReportTemplate> templateList = StatCounterConfigManager.getInstance().getTemplateList(prefixKey);

    // We create a String tab with all descendent of the prefixKey
    String[] descendentSelect = CounterReportTemplate.concat(prefixKey.getAllAttributes(), "^[^_].*");

    // We create a list with all StatKey matching with descendent of prefixKey
    List<StatKey> descendentsList = pool.findMatchingKeyStrict(new StatKey(descendentSelect));
    Collections.sort(descendentsList);

    // We create a new panel for insert a table for short stats
    JPanel jPanelShort = new JPanel();

    // Color of this panel
    jPanelShort.setBackground(ModelTreeRTStats.instance().getColorByString("neutral"));

    // We choose a SpringLayout to have disposition like in a tab
    //jPanelShort.setLayout(new GridLayout(descendentsList.size()+2,0,10,5));
    jPanelShort.setLayout(new SpringLayout());

    // Layout alignment to the left
    jPanelShort.setAlignmentX(java.awt.Component.LEFT_ALIGNMENT);
    jPanelShort.setAlignmentY(java.awt.Component.TOP_ALIGNMENT);

    // We fill jPanelShort with all titles
    if (!templateList.isEmpty()) {
        fillWithSummaryTitles(jPanelShort, prefixKey, templateList);
    }

    // For each descendents
    for (StatKey descendent : descendentsList) {
        // We create a new line with all data
        fillWithData(jPanelShort, descendent, templateList, true);
    }

    // If there is any information in this section
    if (!templateList.isEmpty()) {
        // We add the line with total
        fillWithTotal(jPanelShort, prefixKey, templateList);
    }

    // We create a grid with elements in jPanelShort
    makeCompactGrid(jPanelShort, descendentsList.size() + 2, templateList.size() + 1, 3, 3, 5, 5);

    // We add this short panel to the main panel
    panel.add(jPanelShort);

    // We refresh the panel
    panel.updateUI();
}
 
Example 16
Source File: ToolAdapterTabbedEditorDialog.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected JPanel createVariablesPanel() {
    JPanel variablesBorderPanel = new JPanel();
    BoxLayout layout = new BoxLayout(variablesBorderPanel, BoxLayout.PAGE_AXIS);
    variablesBorderPanel.setLayout(layout);

    AbstractButton addVariableButton =
            ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false);
    addVariableButton.setText(Bundle.CTL_Button_Add_Variable_Text());
    addVariableButton.setMaximumSize(new Dimension(150, controlHeight));
    addVariableButton.setAlignmentX(Component.LEFT_ALIGNMENT);

    AbstractButton addDependentVariableButton =
            ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false);
    addDependentVariableButton.setText(Bundle.CTL_Button_Add_PDVariable_Text());
    addDependentVariableButton.setMaximumSize(new Dimension(250, controlHeight));
    addDependentVariableButton.setAlignmentX(Component.LEFT_ALIGNMENT);

    JPanel buttonsPannel = new JPanel(new SpringLayout());
    buttonsPannel.add(addVariableButton);
    buttonsPannel.add(addDependentVariableButton);
    SpringUtilities.makeCompactGrid(buttonsPannel, 1, 2, 0, 0, 0, 0);
    buttonsPannel.setAlignmentX(Component.LEFT_ALIGNMENT);
    variablesBorderPanel.add(buttonsPannel);

    varTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    varTable.setRowHeight(controlHeight);
    int widths[] = {controlHeight, 3 * controlHeight, 10 * controlHeight};
    for (int i = 0; i < widths.length; i++) {
        TableColumn column = varTable.getColumnModel().getColumn(i);
        column.setPreferredWidth(widths[i]);
        column.setWidth(widths[i]);

    }
    JScrollPane scrollPane = new JScrollPane(varTable);
    scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
    variablesBorderPanel.add(scrollPane);
    variablesBorderPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    Dimension variablesPanelDimension =
            new Dimension((formWidth - 3 * DEFAULT_PADDING) / 2 - 2 * DEFAULT_PADDING, 130);
    variablesBorderPanel.setMinimumSize(variablesPanelDimension);
    variablesBorderPanel.setMaximumSize(variablesPanelDimension);
    variablesBorderPanel.setPreferredSize(variablesPanelDimension);

    addVariableButton.addActionListener(e -> {
        newOperatorDescriptor.getVariables().add(new SystemVariable("key", ""));
        varTable.revalidate();
    });

    addDependentVariableButton.addActionListener(e -> {
        newOperatorDescriptor.getVariables().add(new SystemDependentVariable("key", ""));
        varTable.revalidate();
    });

    return variablesBorderPanel;
}
 
Example 17
Source File: MainWindow.java    From xdm with GNU General Public License v2.0 4 votes vote down vote up
private void createTabs() {
	CustomButton btnAllTab = new CustomButton(StringResource.get("ALL_DOWNLOADS")),
			btnIncompleteTab = new CustomButton(StringResource.get("ALL_UNFINISHED")),
			btnCompletedTab = new CustomButton(StringResource.get("ALL_FINISHED"));

	btnTabArr = new CustomButton[3];
	btnTabArr[0] = btnAllTab;
	btnTabArr[0].setName("ALL_DOWNLOADS");
	btnTabArr[1] = btnIncompleteTab;
	btnTabArr[1].setName("ALL_UNFINISHED");
	btnTabArr[2] = btnCompletedTab;
	btnTabArr[2].setName("ALL_FINISHED");

	for (int i = 0; i < 3; i++) {
		btnTabArr[i].setFont(FontResource.getBigBoldFont());
		btnTabArr[i].setBorderPainted(false);
		btnTabArr[i].setFocusPainted(false);
		btnTabArr[i].addActionListener(this);
	}

	btnAllTab.setBackground(ColorResource.getActiveTabColor());
	btnAllTab.setForeground(ColorResource.getDarkBgColor());

	btnIncompleteTab.setBackground(ColorResource.getTitleColor());
	btnIncompleteTab.setForeground(ColorResource.getDeepFontColor());

	btnCompletedTab.setBackground(ColorResource.getTitleColor());
	btnCompletedTab.setForeground(ColorResource.getDeepFontColor());

	JPanel p = new JPanel(new GridLayout(1, 3, scale(5), 0));
	p.setBorder(null);
	p.setOpaque(false);
	Dimension d = new Dimension(scale(380), scale(30));
	p.setPreferredSize(d);
	p.setMaximumSize(d);
	p.setMinimumSize(d);
	p.setBackground(Color.WHITE);
	p.add(btnAllTab);
	p.add(btnIncompleteTab);
	p.add(btnCompletedTab);

	p.setAlignmentX(Box.RIGHT_ALIGNMENT);

	this.rightbox.add(p);

	// pp.add(p, BorderLayout.EAST);

	// getTitlePanel().add(pp, BorderLayout.SOUTH);
}
 
Example 18
Source File: DeobfuscationDialog.java    From jpexs-decompiler with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public DeobfuscationDialog() {
    setDefaultCloseOperation(HIDE_ON_CLOSE);
    setSize(new Dimension(330, 270));
    setTitle(translate("dialog.title"));
    Container cp = getContentPane();
    cp.setLayout(new BoxLayout(cp, BoxLayout.Y_AXIS));
    codeProcessingLevel = new JSlider(JSlider.VERTICAL, 1, 3, 3);
    codeProcessingLevel.setMajorTickSpacing(1);
    codeProcessingLevel.setPaintTicks(true);
    codeProcessingLevel.setMinorTickSpacing(1);
    codeProcessingLevel.setSnapToTicks(true);
    JLabel lab1 = new JLabel(translate("deobfuscation.level"));
    //lab1.setBounds(30, 0, getWidth() - 60, 25);
    lab1.setAlignmentX(0.5f);
    cp.add(lab1);
    Hashtable<Integer, JLabel> labelTable = new Hashtable<>();
    //labelTable.put(LEVEL_NONE, new JLabel("None"));

    labelTable.put(DeobfuscationLevel.LEVEL_REMOVE_DEAD_CODE.getLevel(), new JLabel(translate("deobfuscation.removedeadcode")));
    labelTable.put(DeobfuscationLevel.LEVEL_REMOVE_TRAPS.getLevel(), new JLabel(translate("deobfuscation.removetraps")));
    labelTable.put(DeobfuscationLevel.LEVEL_RESTORE_CONTROL_FLOW.getLevel(), new JLabel(translate("deobfuscation.restorecontrolflow")));
    codeProcessingLevel.setLabelTable(labelTable);

    codeProcessingLevel.setPaintLabels(true);
    codeProcessingLevel.setAlignmentX(Component.CENTER_ALIGNMENT);
    //codeProcessingLevel.setSize(300, 200);

    //codeProcessingLevel.setBounds(30, 25, getWidth() - 60, 125);
    codeProcessingLevel.setAlignmentX(0.5f);
    add(codeProcessingLevel);
    //processAllCheckbox.setBounds(50, 150, getWidth() - 100, 25);
    processAllCheckbox.setAlignmentX(0.5f);
    add(processAllCheckbox);

    processAllCheckbox.setSelected(true);

    JButton cancelButton = new JButton(translate("button.cancel"));
    cancelButton.addActionListener(this::cancelButtonActionPerformed);
    JButton okButton = new JButton(translate("button.ok"));
    okButton.addActionListener(this::okButtonActionPerformed);

    JPanel buttonsPanel = new JPanel(new FlowLayout());
    buttonsPanel.add(okButton);
    buttonsPanel.add(cancelButton);
    buttonsPanel.setAlignmentX(0.5f);
    cp.add(buttonsPanel);

    setModal(true);
    View.centerScreen(this);
    setIconImage(View.loadImage("deobfuscate16"));
}
 
Example 19
Source File: SBOLInputDialog.java    From iBioSim with Apache License 2.0 4 votes vote down vote up
private void initGUI() 
{
	JPanel buttonPanel = new JPanel();
	buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
	buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));

	if (registrySelection != null) {
		optionsButton = new JButton("Options");
		optionsButton.addActionListener(actionListener);
		buttonPanel.add(optionsButton);
	}

	buttonPanel.add(Box.createHorizontalStrut(200));
	buttonPanel.add(Box.createHorizontalGlue());
	
	cancelButton = new JButton("Cancel");
	cancelButton.addActionListener(actionListener);
	cancelButton.registerKeyboardAction(actionListener, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
			JComponent.WHEN_IN_FOCUSED_WINDOW);
	buttonPanel.add(cancelButton);
	
	openVPRGenerator = new JButton("Generate Model");
	openVPRGenerator.addActionListener(actionListener);
	openVPRGenerator.setEnabled(true);
	getRootPane().setDefaultButton(openVPRGenerator);
	buttonPanel.add(openVPRGenerator);
	
	openSBOLDesigner = new JButton("Open SBOLDesigner");
	openSBOLDesigner.addActionListener(actionListener);
	openSBOLDesigner.setEnabled(true);
	getRootPane().setDefaultButton(openSBOLDesigner);
	buttonPanel.add(openSBOLDesigner);
	
	initFormPanel(builder);

	JComponent formPanel = builder.build();
	formPanel.setAlignmentX(LEFT_ALIGNMENT);

	Box topPanel = Box.createVerticalBox();
	String message = initMessage();
	if (message != null) {
		JPanel messageArea = new JPanel();
		messageArea.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6),
				BorderFactory.createEtchedBorder()));
		messageArea.setAlignmentX(LEFT_ALIGNMENT);
		messageArea.add(new JLabel("<html>" + message.replace("\n", "<br>") + "</html>"));
		topPanel.add(messageArea);
	}
	topPanel.add(formPanel);

	JComponent mainPanel = initMainPanel();

	JPanel contentPane = new JPanel(new BorderLayout());
	contentPane.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
	contentPane.add(topPanel, BorderLayout.NORTH);
	if (mainPanel != null) {
		contentPane.add(mainPanel, BorderLayout.CENTER);
	}
	contentPane.add(buttonPanel, BorderLayout.SOUTH);

	setContentPane(contentPane);

	initFinished();

	if (registrySelection != null) {
		registryChanged();
	}

	pack();
	setLocationRelativeTo(getOwner());
}
 
Example 20
Source File: DiscardFilter.java    From GpsPrune with GNU General Public License v2.0 4 votes vote down vote up
/** Make the panel contents */
	protected void makePanelContents()
	{
		setLayout(new BorderLayout());
		JPanel boxPanel = new JPanel();
		boxPanel.setLayout(new BoxLayout(boxPanel, BoxLayout.Y_AXIS));
		JLabel topLabel = new JLabel(I18nManager.getText("dialog.gpsbabel.filter.discard.intro"));
		topLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
		boxPanel.add(topLabel);
		boxPanel.add(Box.createVerticalStrut(9)); // spacer

		JPanel boxPanel2 = new JPanel();
		boxPanel2.setLayout(new BoxLayout(boxPanel2, BoxLayout.Y_AXIS));
		// Panel for dops
		JPanel dopPanel = new JPanel();
		dopPanel.setBorder(BorderFactory.createCompoundBorder(
			BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(4, 4, 4, 4))
		);
		dopPanel.setLayout(new GridLayout(0, 3, 4, 2));
		dopPanel.add(new JLabel(I18nManager.getText("dialog.gpsbabel.filter.discard.hdop"), SwingConstants.RIGHT));
		_hdopField = new WholeNumberField(2);
		_hdopField.addKeyListener(_paramChangeListener);
		dopPanel.add(_hdopField);
		_combineDopsCombo = new JComboBox<String>(new String[] {I18nManager.getText("logic.and"), I18nManager.getText("logic.or")});
		dopPanel.add(_combineDopsCombo);
		dopPanel.add(new JLabel(I18nManager.getText("dialog.gpsbabel.filter.discard.vdop"), SwingConstants.RIGHT));
		_vdopField = new WholeNumberField(2);
		_vdopField.addKeyListener(_paramChangeListener);
		dopPanel.add(_vdopField);
		boxPanel2.add(dopPanel);

		// Number of satellites
		JPanel satPanel = new JPanel();
		satPanel.add(new JLabel(I18nManager.getText("dialog.gpsbabel.filter.discard.numsats")));
		_numSatsField = new WholeNumberField(2);
		_numSatsField.addKeyListener(_paramChangeListener);
		satPanel.add(_numSatsField);
		boxPanel2.add(satPanel);

		// Checkboxes for no fix and unknown fix
		_noFixCheckbox = new JCheckBox(I18nManager.getText("dialog.gpsbabel.filter.discard.nofix"));
		boxPanel2.add(_noFixCheckbox);
		_unknownFixCheckbox = new JCheckBox(I18nManager.getText("dialog.gpsbabel.filter.discard.unknownfix"));
		boxPanel2.add(_unknownFixCheckbox);
		boxPanel2.add(Box.createVerticalStrut(9)); // spacer

		boxPanel2.setAlignmentX(Component.LEFT_ALIGNMENT);
		boxPanel.add(boxPanel2);
		add(boxPanel, BorderLayout.NORTH);
}