List of usage examples for java.awt Component LEFT_ALIGNMENT
float LEFT_ALIGNMENT
To view the source code for java.awt Component LEFT_ALIGNMENT.
Click Source Link
From source file:org.eclipse.wb.tests.designer.core.util.reflect.ReflectionUtilsTest.java
public void test_getFieldFloat() throws Exception { assertEquals(Component.LEFT_ALIGNMENT, ReflectionUtils.getFieldFloat(Component.class, "LEFT_ALIGNMENT"), 0.001);/*w w w. jav a2 s . co m*/ }
From source file:AppearanceExplorer.java
LineAttributesEditor(LineAttributes init) { super(BoxLayout.Y_AXIS); lineAttr = init;/*from w w w.java 2 s.co m*/ lineWidth = lineAttr.getLineWidth(); linePattern = lineAttr.getLinePattern(); lineAAEnable = lineAttr.getLineAntialiasingEnable(); FloatLabelJSlider lineWidthSlider = new FloatLabelJSlider("Width", 0.1f, 0.0f, 5.0f, lineWidth); lineWidthSlider.setMajorTickSpacing(1.0f); lineWidthSlider.setPaintTicks(true); lineWidthSlider.addFloatListener(new FloatListener() { public void floatChanged(FloatEvent e) { lineWidth = e.getValue(); lineAttr.setLineWidth(lineWidth); } }); lineWidthSlider.setAlignmentX(Component.LEFT_ALIGNMENT); add(lineWidthSlider); String[] patternNames = { "PATTERN_SOLID", "PATTERN_DASH", "PATTERN_DOT", "PATTERN_DASH_DOT" }; int[] patternValues = { LineAttributes.PATTERN_SOLID, LineAttributes.PATTERN_DASH, LineAttributes.PATTERN_DOT, LineAttributes.PATTERN_DASH_DOT }; IntChooser patternChooser = new IntChooser("Pattern:", patternNames, patternValues, linePattern); patternChooser.addIntListener(new IntListener() { public void intChanged(IntEvent event) { int value = event.getValue(); lineAttr.setLinePattern(value); } }); patternChooser.setAlignmentX(Component.LEFT_ALIGNMENT); add(patternChooser); JCheckBox lineAACheckBox = new JCheckBox(antiAliasString); lineAACheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox checkbox = (JCheckBox) e.getSource(); lineAAEnable = checkbox.isSelected(); lineAttr.setLineAntialiasingEnable(lineAAEnable); } }); lineAACheckBox.setAlignmentX(Component.LEFT_ALIGNMENT); // add the checkbox to the panel add(lineAACheckBox); }
From source file:gov.llnl.lustre.lwatch.PlotFrame2.java
/** * Build the GUI./*from www. jav a 2 s . c o m*/ * * @param container container in which GUI will be built. */ void buildUI(Container container) { container.setLayout(new BorderLayout()); plotPanel = new JPanel(); ppgbl = new GridBagLayout(); plotPanel.setLayout(ppgbl); plotPanel.setBackground(Color.black); chartContainerPane = new ChartContainerPanel(this); plotPanel.add(chartContainerPane); ppc = new GridBagConstraints(); ppc.gridx = 0; ppc.gridy = 0; ppc.insets = new Insets(2, 2, 0, 2); //(8, 4, 0, 5); ppc.anchor = GridBagConstraints.NORTH; ppc.fill = GridBagConstraints.BOTH; ppc.weightx = 1.0; //1.0; ppc.weighty = .75; //0.0; ppgbl.setConstraints(chartContainerPane, ppc); // Add panel for the overview data and pan & zoom control wideView = new OverView(); //(this); plotPanel.add(wideView); ppc = new GridBagConstraints(); ppc.gridx = 0; ppc.gridy = 1; // Insets are Top, Left, Bottom, Right ppc.insets = new Insets(0, 76, 10, 18); //(8, 4, 0, 5); ppc.anchor = GridBagConstraints.NORTH; ppc.fill = GridBagConstraints.BOTH; ppc.weightx = 1.0; ppc.weighty = 0.25; //0.15; //1.0; ppgbl.setConstraints(wideView, ppc); // container.add(plotPanel, BorderLayout.CENTER); scPane = new StatControlPanel(); //controls = new ControlPanel(); JPanel idAndHideControlPanel = new JPanel(); FlowLayout iaccLayout = new FlowLayout(FlowLayout.LEFT); idAndHideControlPanel.setLayout(iaccLayout); if (rawData != null) label = new JLabel( "Panel dimension : " + chartContainerPane.getWidth() + " X " + chartContainerPane.getHeight()); else label = new JLabel("Error: accessing raw data from \"timehist.dat\""); idLabel = new JLabel(fsName + " (" + type + ") Time History Plot"); idAndHideControlPanel.add(idLabel); cpHideButt = new JButton("Hide Controls"); cpHideButt.setFont(new Font("helvetica", Font.BOLD, 10)); cpHideButt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String buttonLabel = e.getActionCommand(); //System.out.println(buttonLabel + " button pressed."); if (buttonLabel.indexOf("Hide") < 0) { showControls(); cpHideButt.setText("Hide Controls"); } else if (buttonLabel.indexOf("Show") < 0) { hideControls(); cpHideButt.setText("Show Controls"); } //catPanel.selectAll(); } }); idAndHideControlPanel.add(cpHideButt); ovpHideButt = new JButton("Hide Overview Plot"); ovpHideButt.setFont(new Font("helvetica", Font.BOLD, 10)); ovpHideButt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String buttonLabel = e.getActionCommand(); //System.out.println(buttonLabel + " button pressed."); if (buttonLabel.indexOf("Hide") < 0) { showOverviewPlot(); ovpHideButt.setText("Hide Overview Plot"); } else if (buttonLabel.indexOf("Show") < 0) { hideOverviewPlot(); ovpHideButt.setText("Show Overview Plot"); } //catPanel.selectAll(); } }); idAndHideControlPanel.add(ovpHideButt); container.add(scPane, BorderLayout.SOUTH); //container.add(idLabel, BorderLayout.NORTH); container.add(idAndHideControlPanel, BorderLayout.NORTH); //ra.setAlignmentX(java.awt.Component.LEFT_ALIGNMENT); chartContainerPane.setAlignmentX(java.awt.Component.LEFT_ALIGNMENT); label.setAlignmentX(java.awt.Component.LEFT_ALIGNMENT); // Unecessary, but won't hurt. updateControlValues(); //this.thpFrame.pack(); //this.thpFrame.setVisible(true); // Added timer start in case HEARTBEAT came thru as prefs granularity. if (granularity == HEARTBEAT) { //setRefresh(refreshRate, 3600000); refreshPlotFrame(); } }
From source file:lcmc.gui.resources.ServiceInfo.java
/** Returns info panel with comboboxes for service parameters. */ @Override/*from ww w. ja v a 2 s . co m*/ public JComponent getInfoPanel() { if (!getResourceAgent().isMetaDataLoaded()) { final JPanel p = new JPanel(); p.add(new JLabel(Tools.getString("ServiceInfo.LoadingMetaData"))); return p; } final CloneInfo ci = getCloneInfo(); if (ci == null) { getBrowser().getCRMGraph().pickInfo(this); } else { getBrowser().getCRMGraph().pickInfo(ci); } if (infoPanel != null) { return infoPanel; } /* init save button */ final boolean abExisted = getApplyButton() != null; final ServiceInfo thisClass = this; final ButtonCallback buttonCallback = new ButtonCallback() { private volatile boolean mouseStillOver = false; /** * Whether the whole thing should be enabled. */ @Override public final boolean isEnabled() { final Host dcHost = getBrowser().getDCHost(); if (dcHost == null) { return false; } if (Tools.versionBeforePacemaker(dcHost)) { return false; } return true; } @Override public final void mouseOut() { if (!isEnabled()) { return; } mouseStillOver = false; getBrowser().getCRMGraph().stopTestAnimation(getApplyButton()); getApplyButton().setToolTipText(null); } @Override public final void mouseOver() { if (!isEnabled()) { return; } mouseStillOver = true; getApplyButton().setToolTipText(ClusterBrowser.STARTING_PTEST_TOOLTIP); getApplyButton() .setToolTipBackground(Tools.getDefaultColor("ClusterBrowser.Test.Tooltip.Background")); Tools.sleep(250); if (!mouseStillOver) { return; } mouseStillOver = false; final CountDownLatch startTestLatch = new CountDownLatch(1); getBrowser().getCRMGraph().startTestAnimation(getApplyButton(), startTestLatch); final Host dcHost = getBrowser().getDCHost(); getBrowser().ptestLockAcquire(); final ClusterStatus cs = getBrowser().getClusterStatus(); cs.setPtestData(null); apply(dcHost, true); final PtestData ptestData = new PtestData(CRM.getPtest(dcHost)); getApplyButton().setToolTipText(ptestData.getToolTip()); cs.setPtestData(ptestData); getBrowser().ptestLockRelease(); startTestLatch.countDown(); } }; if (getResourceAgent().isGroup()) { initApplyButton(buttonCallback, Tools.getString("Browser.ApplyGroup")); } else { initApplyButton(buttonCallback); } if (ci != null) { ci.setApplyButton(getApplyButton()); ci.setRevertButton(getRevertButton()); } /* add item listeners to the apply button. */ if (!abExisted) { getApplyButton().addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final Thread thread = new Thread(new Runnable() { @Override public void run() { getBrowser().clStatusLock(); apply(getBrowser().getDCHost(), false); getBrowser().clStatusUnlock(); } }); thread.start(); } }); getRevertButton().addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final Thread thread = new Thread(new Runnable() { @Override public void run() { getBrowser().clStatusLock(); revert(); getBrowser().clStatusUnlock(); } }); thread.start(); } }); } /* main, button and options panels */ final JPanel mainPanel = new JPanel(); mainPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); final JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.setBackground(ClusterBrowser.BUTTON_PANEL_BACKGROUND); buttonPanel.setMinimumSize(new Dimension(0, 50)); buttonPanel.setPreferredSize(new Dimension(0, 50)); buttonPanel.setMaximumSize(new Dimension(Short.MAX_VALUE, 50)); final JPanel optionsPanel = new JPanel(); optionsPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND); optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.Y_AXIS)); optionsPanel.setAlignmentX(Component.LEFT_ALIGNMENT); /* Actions */ final JMenuBar mb = new JMenuBar(); mb.setBackground(ClusterBrowser.PANEL_BACKGROUND); AbstractButton serviceMenu; if (ci == null) { serviceMenu = getActionsButton(); } else { serviceMenu = ci.getActionsButton(); } buttonPanel.add(serviceMenu, BorderLayout.EAST); String defaultValue = PRIMITIVE_TYPE_STRING; if (ci != null) { if (ci.getService().isMaster()) { defaultValue = MASTER_SLAVE_TYPE_STRING; } else { defaultValue = CLONE_TYPE_STRING; } } if (!getResourceAgent().isClone() && getGroupInfo() == null) { typeRadioGroup = new Widget(defaultValue, new String[] { PRIMITIVE_TYPE_STRING, CLONE_TYPE_STRING, MASTER_SLAVE_TYPE_STRING }, null, /* units */ Widget.Type.RADIOGROUP, null, /* regexp */ ClusterBrowser.SERVICE_LABEL_WIDTH + ClusterBrowser.SERVICE_FIELD_WIDTH, null, /* abbrv */ new AccessMode(ConfigData.AccessType.ADMIN, false)); if (!getService().isNew()) { typeRadioGroup.setEnabled(false); } typeRadioGroup.addListeners(new WidgetListener() { @Override public void check(final Object value) { changeType(((JRadioButton) value).getText()); } }); final JPanel tp = new JPanel(); tp.setBackground(ClusterBrowser.PANEL_BACKGROUND); tp.setLayout(new BoxLayout(tp, BoxLayout.Y_AXIS)); tp.add(typeRadioGroup); typeRadioGroup.setBackgroundColor(ClusterBrowser.PANEL_BACKGROUND); optionsPanel.add(tp); } if (ci != null) { /* add clone fields */ addCloneFields(optionsPanel, ClusterBrowser.SERVICE_LABEL_WIDTH, ClusterBrowser.SERVICE_FIELD_WIDTH); } getResource().setValue(GUI_ID, getService().getId()); /* get dependent resources and create combo boxes for ones, that * need parameters */ final String[] params = getParametersFromXML(); final Info savedMAIdRef = savedMetaAttrInfoRef; addParams(optionsPanel, params, ClusterBrowser.SERVICE_LABEL_WIDTH, ClusterBrowser.SERVICE_FIELD_WIDTH, getSameAsFields(savedMAIdRef)); if (ci == null) { /* score combo boxes */ addHostLocations(optionsPanel, ClusterBrowser.SERVICE_LABEL_WIDTH, ClusterBrowser.SERVICE_FIELD_WIDTH); } for (final String param : params) { if (isMetaAttr(param)) { final Widget wi = getWidget(param, null); wi.setEnabled(savedMAIdRef == null); } } if (!getService().isNew()) { getWidget(GUI_ID, null).setEnabled(false); } if (!getResourceAgent().isGroup() && !getResourceAgent().isClone()) { /* Operations */ addOperations(optionsPanel, ClusterBrowser.SERVICE_LABEL_WIDTH, ClusterBrowser.SERVICE_FIELD_WIDTH); /* add item listeners to the operations combos */ for (final String op : getResourceAgent().getOperationNames()) { for (final String param : getBrowser().getCRMOperationParams(op)) { addOperationListeners(op, param); } } } /* add item listeners to the host scores combos */ if (ci == null) { addHostLocationsListeners(); } else { ci.addHostLocationsListeners(); } /* apply button */ addApplyButton(buttonPanel); addRevertButton(buttonPanel); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { /* invoke later on purpose */ setApplyButtons(null, params); } }); mainPanel.add(optionsPanel); final JPanel newPanel = new JPanel(); newPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND); newPanel.setLayout(new BoxLayout(newPanel, BoxLayout.Y_AXIS)); newPanel.add(buttonPanel); newPanel.add( getMoreOptionsPanel(ClusterBrowser.SERVICE_LABEL_WIDTH + ClusterBrowser.SERVICE_FIELD_WIDTH + 4)); newPanel.add(new JScrollPane(mainPanel)); /* if id textfield was changed and this id is not used, * enable apply button */ infoPanel = newPanel; infoPanelDone(); return infoPanel; }