Java Code Examples for javax.swing.JRadioButton#setAlignmentX()
The following examples show how to use
javax.swing.JRadioButton#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: ReplaceTraceDialog.java From jpexs-decompiler with GNU General Public License v3.0 | 5 votes |
public ReplaceTraceDialog(String defaultVal) { setTitle(translate("dialog.title")); Container cnt = getContentPane(); cnt.setLayout(new BoxLayout(cnt, BoxLayout.Y_AXIS)); debugAlertRadio = new JRadioButton(translate("function.debugAlert")); debugAlertRadio.setAlignmentX(0); debugConsoleRadio = new JRadioButton(translate("function.debugConsole")); debugConsoleRadio.setAlignmentX(0); debugSocketRadio = new JRadioButton(translate("function.debugSocket")); debugSocketRadio.setAlignmentX(0); debugAlertRadio.setSelected(true); ButtonGroup bg = new ButtonGroup(); bg.add(debugAlertRadio); bg.add(debugConsoleRadio); bg.add(debugSocketRadio); cnt.add(debugAlertRadio); cnt.add(debugConsoleRadio); cnt.add(debugSocketRadio); JPanel buttonsPanel = new JPanel(new FlowLayout()); JButton okButton = new JButton(AppStrings.translate("button.ok")); okButton.addActionListener(this::okButtonActionPerformed); JButton cancelButton = new JButton(AppStrings.translate("button.cancel")); cancelButton.addActionListener(this::cancelButtonActionPerformed); buttonsPanel.add(okButton); buttonsPanel.add(cancelButton); buttonsPanel.setAlignmentX(0); add(buttonsPanel); setModalityType(DEFAULT_MODALITY_TYPE); pack(); View.setWindowIcon(this); View.centerScreen(this); setValue(defaultVal); }
Example 2
Source File: ProjectCalendarOptionPageProvider.java From ganttproject with GNU General Public License v3.0 | 4 votes |
@Override public Component buildPageComponent() { final GanttLanguage i18n = GanttLanguage.getInstance(); final Box result = Box.createVerticalBox(); myWeekendsPanel = new WeekendsSettingsPanel(getProject(), getUiFacade()); myWeekendsPanel.setAlignmentX(Component.LEFT_ALIGNMENT); myWeekendsPanel.initialize(); result.add(myWeekendsPanel); result.add(Box.createVerticalStrut(15)); myProjectStart = getProject().getTaskManager().getProjectStart(); myProjectStartOption = new DefaultDateOption("project.startDate", myProjectStart) { private TimeDuration getMoveDuration() { return getProject().getTaskManager().createLength(getProject().getTimeUnitStack().getDefaultTimeUnit(), getInitialValue(), getValue()); } @Override public void setValue(Date value) { super.setValue(value); TimeDuration moveDuration = getMoveDuration(); if (moveDuration.getLength() != 0) { updateMoveOptions(moveDuration); } } @Override public void commit() { super.commit(); if (!isChanged()) { return; } try { moveProject(getMoveDuration()); } catch (AlgorithmException e) { getUiFacade().showErrorDialog(e); } } }; myMoveOptionsPanel = Box.createVerticalBox(); myMoveOptionsPanel.setAlignmentX(Component.LEFT_ALIGNMENT); Box dateComponent = Box.createHorizontalBox(); OptionsPageBuilder builder = new OptionsPageBuilder(); dateComponent.add(new JLabel(i18n.getText(builder.getI18N().getCanonicalOptionLabelKey(myProjectStartOption)))); dateComponent.add(Box.createHorizontalStrut(3)); dateComponent.add(builder.createDateComponent(myProjectStartOption)); dateComponent.setAlignmentX(Component.LEFT_ALIGNMENT); myMoveOptionsPanel.add(dateComponent); myMoveOptionsPanel.add(Box.createVerticalStrut(5)); myMoveStrategyPanelWrapper = new JPanel(new BorderLayout()) { @Override public void paint(Graphics g) { if (isEnabled()) { super.paint(g); return; } final BufferedImage buf = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB); super.paint(buf.getGraphics()); final float[] my_kernel = { 0.0625f, 0.125f, 0.0625f, 0.125f, 0.25f, 0.125f, 0.0625f, 0.125f, 0.0625f }; final ConvolveOp op = new ConvolveOp(new Kernel(3, 3, my_kernel), ConvolveOp.EDGE_NO_OP, null); Image img = op.filter(buf, null); g.drawImage(img, 0, 0, null); } }; myMoveStrategyPanelWrapper.setAlignmentX(Component.LEFT_ALIGNMENT); myMoveAllTasks = new JRadioButton(i18n.getText("project.calendar.moveAll.label")); myMoveAllTasks.setAlignmentX(Component.LEFT_ALIGNMENT); myMoveStartingTasks = new JRadioButton(MessageFormat.format(i18n.getText("project.calendar.moveSome.label"), i18n.formatDate(CalendarFactory.createGanttCalendar(myProjectStart)))); myMoveStartingTasks.setAlignmentX(Component.LEFT_ALIGNMENT); ButtonGroup moveGroup = new ButtonGroup(); moveGroup.add(myMoveAllTasks); moveGroup.add(myMoveStartingTasks); moveGroup.setSelected(myMoveAllTasks.getModel(), true); Box moveStrategyPanel = Box.createVerticalBox(); myMoveDurationLabel = new JLabel(); myMoveDurationLabel.setAlignmentX(Component.LEFT_ALIGNMENT); moveStrategyPanel.add(myMoveDurationLabel); moveStrategyPanel.add(myMoveAllTasks); moveStrategyPanel.add(myMoveStartingTasks); myMoveStrategyPanelWrapper.add(moveStrategyPanel, BorderLayout.CENTER); myMoveOptionsPanel.add(Box.createVerticalStrut(3)); myMoveOptionsPanel.add(myMoveStrategyPanelWrapper); UIUtil.createTitle(myMoveOptionsPanel, i18n.getText("project.calendar.move.title")); result.add(myMoveOptionsPanel); updateMoveOptions(getProject().getTaskManager().createLength(0)); return OptionPageProviderBase.wrapContentComponent(result, getCanonicalPageTitle(), null); }
Example 3
Source File: ConfigWindow.java From rscplus with GNU General Public License v3.0 | 3 votes |
/** * Adds a preconfigured radio button to the specified container. Does not currently assign the * radio button to a group. * * @param text The text of the radio button * @param container The container to add the button to * @param leftIndent The amount of padding to add to the left of the radio button as an empty * border argument. * @return The newly created JRadioButton */ private JRadioButton addRadioButton(String text, Container container, int leftIndent) { JRadioButton radioButton = new JRadioButton(text); radioButton.setAlignmentX(Component.LEFT_ALIGNMENT); radioButton.setBorder(BorderFactory.createEmptyBorder(0, leftIndent, 7, 5)); container.add(radioButton); return radioButton; }