List of usage examples for javax.swing BorderFactory createEtchedBorder
public static Border createEtchedBorder()
From source file:ch.zhaw.simulation.diagram.charteditor.DefaultTitleEditor.java
/** * Standard constructor: builds a panel for displaying/editing the * properties of the specified title./* ww w . j a v a 2 s . c o m*/ * * @param title * the title, which should be changed. */ public DefaultTitleEditor(Title title) { if (title == null) { this.showTitle = false; this.titleFont = SimulationDiagramTheme.DEFAULT_TITLE_FONT; this.titleField = new JTextField(); this.titlePaint = new PaintSample(Color.BLACK); } else { TextTitle t = (TextTitle) title; this.showTitle = title.isVisible(); this.titleFont = t.getFont(); this.titleField = new JTextField(t.getText()); this.titlePaint = new PaintSample(t.getPaint()); } System.out.println(this.titleFont.getName()); setLayout(new BorderLayout()); JPanel general = new JPanel(new BorderLayout()); general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), localizationResources.getString("General"))); JPanel interior = new JPanel(new LCBLayout(4)); interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); interior.add(new JLabel(localizationResources.getString("Show_Title"))); this.showTitleCheckBox = new JCheckBox(); this.showTitleCheckBox.setSelected(this.showTitle); this.showTitleCheckBox.setActionCommand("ShowTitle"); this.showTitleCheckBox.addActionListener(this); interior.add(new JPanel()); interior.add(this.showTitleCheckBox); JLabel titleLabel = new JLabel(localizationResources.getString("Text")); interior.add(titleLabel); interior.add(this.titleField); interior.add(new JPanel()); JLabel fontLabel = new JLabel(localizationResources.getString("Font")); this.fontfield = new FontDisplayField(this.titleFont); this.selectFontButton = new JButton(localizationResources.getString("Select...")); this.selectFontButton.setActionCommand("SelectFont"); this.selectFontButton.addActionListener(this); interior.add(fontLabel); interior.add(this.fontfield); interior.add(this.selectFontButton); JLabel colorLabel = new JLabel(localizationResources.getString("Color")); this.selectPaintButton = new JButton(localizationResources.getString("Select...")); this.selectPaintButton.setActionCommand("SelectPaint"); this.selectPaintButton.addActionListener(this); interior.add(colorLabel); interior.add(this.titlePaint); interior.add(this.selectPaintButton); this.enableOrDisableControls(); general.add(interior); add(general, BorderLayout.NORTH); }
From source file:ca.sqlpower.architect.swingui.ProfileGraphPanel.java
public ProfileGraphPanel(ProfilePanel panel, int rowCount) { this.profilePanel = panel; this.rowCount = rowCount; FormLayout displayLayout = new FormLayout("4dlu, default, 4dlu, 100dlu, 4dlu, fill:default:grow, 4dlu", // columns "4dlu, default, 6dlu"); // rows CellConstraints cc = new CellConstraints(); validResultsPanel = ProfileGraphPanel.logger.isDebugEnabled() ? new FormDebugPanel(displayLayout) : new JPanel(displayLayout); validResultsPanel.setBorder(BorderFactory.createEtchedBorder()); Font bodyFont = validResultsPanel.getFont(); Font titleFont = bodyFont.deriveFont(Font.BOLD, bodyFont.getSize() * 1.25F); title = new JLabel("Column Name"); title.setFont(titleFont);// www. ja v a 2 s. c o m PanelBuilder pb = new PanelBuilder(displayLayout, validResultsPanel); pb.add(title, cc.xyw(2, 2, 5)); int row = 4; rowCountDisplay = makeInfoRow(pb, "RowCount", row); row += 2; nullableLabel = makeInfoRow(pb, "Nullable", row); row += 2; nullCountLabel = makeInfoRow(pb, "Null Count", row); row += 2; nullPercentLabel = makeInfoRow(pb, "% Null Records", row); row += 2; minLengthLabel = makeInfoRow(pb, "Minimum Length", row); row += 2; maxLengthLabel = makeInfoRow(pb, "Maximum Length", row); row += 2; uniqueCountLabel = makeInfoRow(pb, "Unique Values", row); row += 2; uniquePercentLabel = makeInfoRow(pb, "% Unique", row); row += 2; minValue = makeInfoRow(pb, "Minimum Value", row); row += 2; maxValue = makeInfoRow(pb, "Maximum Value", row); row += 2; avgValue = makeInfoRow(pb, "Average Value", row); row += 2; freqValueTable = new FreqValueTable(null); freqValueSp = new JScrollPane(freqValueTable); pb.appendRow("fill:10dlu:grow"); pb.appendRow("fill:default:grow"); pb.add(freqValueSp, cc.xyw(2, row + 1, 3)); // Now add something to represent the chart JFreeChart createPieChart = ChartFactory.createPieChart("", new DefaultPieDataset(new DefaultKeyedValues()), false, false, false); chartPanel = new ChartPanel(createPieChart); chartPanel.setPreferredSize(new Dimension(300, 300)); if (panel.getProfileManager().getWorkspaceContainer() instanceof ArchitectSession && ((ArchitectSession) panel.getProfileManager().getWorkspaceContainer()).isEnterpriseSession()) { pb.add(new JLabel("Column Profile Notes"), cc.xy(6, 2)); notesField = new JTextArea(); notesField.setLineWrap(true); notesField.setWrapStyleWord(true); JScrollPane notesScroll = new JScrollPane(notesField); notesScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); notesScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); pb.add(notesScroll, cc.xywh(6, 4, 1, row - 4)); pb.appendRow("fill:4dlu:grow"); pb.appendRow("4dlu"); pb.add(chartPanel, cc.xy(6, row + 1)); } else { pb.appendRow("fill:4dlu:grow"); pb.appendRow("4dlu"); pb.add(chartPanel, cc.xywh(6, 4, 1, row - 2)); } invalidResultsPanel = new JPanel(new BorderLayout()); invalidResultsLabel = new JLabel("No error message yet"); invalidResultsPanel.add(invalidResultsLabel); displayArea = new JPanel(new GridLayout(1, 1)); displayArea.setPreferredSize(validResultsPanel.getPreferredSize()); }
From source file:FileChooserTest.java
/** * Constructs an ImagePreviewer.// w ww . j a v a 2 s . co m * @param chooser the file chooser whose property changes trigger an image change in this * previewer */ public ImagePreviewer(JFileChooser chooser) { setPreferredSize(new Dimension(100, 100)); setBorder(BorderFactory.createEtchedBorder()); chooser.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getPropertyName() == JFileChooser.SELECTED_FILE_CHANGED_PROPERTY) { // the user has selected a new file File f = (File) event.getNewValue(); if (f == null) { setIcon(null); return; } // read the image into an icon ImageIcon icon = new ImageIcon(f.getPath()); // if the icon is too large to fit, scale it if (icon.getIconWidth() > getWidth()) icon = new ImageIcon( icon.getImage().getScaledInstance(getWidth(), -1, Image.SCALE_DEFAULT)); setIcon(icon); } } }); }
From source file:Main.java
private void initScreen() { setBorder(BorderFactory.createEtchedBorder()); setLayout(new GridBagLayout()); sourceLabel = new JLabel(DEFAULT_SOURCE_CHOICE_LABEL); sourceListModel = new SortedListModel(); sourceList = new JList(sourceListModel); add(sourceLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, EMPTY_INSETS, 0, 0)); add(new JScrollPane(sourceList), new GridBagConstraints(0, 1, 1, 5, .5, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, EMPTY_INSETS, 0, 0)); addButton = new JButton(ADD_BUTTON_LABEL); add(addButton, new GridBagConstraints(1, 2, 1, 2, 0, .25, GridBagConstraints.CENTER, GridBagConstraints.NONE, EMPTY_INSETS, 0, 0)); addButton.addActionListener(new AddListener()); removeButton = new JButton(REMOVE_BUTTON_LABEL); add(removeButton, new GridBagConstraints(1, 4, 1, 2, 0, .25, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); removeButton.addActionListener(new RemoveListener()); destLabel = new JLabel(DEFAULT_DEST_CHOICE_LABEL); destListModel = new SortedListModel(); destList = new JList(destListModel); add(destLabel, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, EMPTY_INSETS, 0, 0));//from ww w . j a v a2 s . c om add(new JScrollPane(destList), new GridBagConstraints(2, 1, 1, 5, .5, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, EMPTY_INSETS, 0, 0)); }
From source file:gda.gui.oemove.plugins.UndulatorControl.java
private void createDisplayComponent() { displayComponent = new JPanel(); // JTabbedPane jtp = new JTabbedPane(); JPanel innerDisplayComponent = new JPanel(new BorderLayout()); JPanel topPanel = new JPanel(new BorderLayout()); JPanel changes = new JPanel(new GridLayout(4, 0)); JPanel current = new JPanel(new BorderLayout()); JPanel currentLabels = new JPanel(new GridLayout(4, 0)); JPanel currentFields = new JPanel(new GridLayout(4, 0)); currentEnergyField = new DefaultDOFPositionDisplay(undulator, "UndulatorEnergy", 15, false); currentPolarizationField = new PolarizationDOFPositionDisplay(undulator, "UndulatorPolarization", 15, false);/*w w w . ja v a2 s.co m*/ currentHarmonicField = new HarmonicDOFPositionDisplay(undulator, "UndulatorHarmonic", 15, false); currentLabels.add(new JLabel("")); currentLabels.add(new JLabel("Energy (eV")); currentLabels.add(new JLabel("Polarization")); currentLabels.add(new JLabel("Harmonic")); current.add(currentLabels, BorderLayout.WEST); currentFields.add(new JLabel("Current")); currentFields.add(currentEnergyField); currentFields.add(currentPolarizationField); currentFields.add(currentHarmonicField); current.add(currentFields, BorderLayout.EAST); topPanel.add(current, BorderLayout.WEST); energyField = new JTextField(currentEnergyField.getText(), 10); polarizationCombo = new PolarizationDOFInputDisplay(); polarizationCombo.setBorder(null); harmonicCombo = new HarmonicDOFInputDisplay(); harmonicCombo.setBorder(null); changes.add(new JLabel("Move to")); changes.add(energyField); changes.add(polarizationCombo); changes.add(harmonicCombo); topPanel.add(changes, BorderLayout.EAST); topPanel.setBorder(BorderFactory.createEtchedBorder()); createButtonPanel(); innerDisplayComponent.add(topPanel, BorderLayout.NORTH); innerDisplayComponent.add(buttonPanel, BorderLayout.SOUTH); // jtp.addTab("Move", innerDisplayComponent); // createViewPanel(); // DO NOT REMOVE THIS, it is commented out because the viewPanel is // still // under test // jtp.addTab("View", viewPanel); // displayComponent.add(jtp); displayComponent.add(innerDisplayComponent); }
From source file:forge.screens.deckeditor.DeckImport.java
/** * Instantiates a new deck import.//from w w w .j a v a 2 s . com * * @param g * the g */ public DeckImport(final ACEditorBase<TItem, TModel> g) { this.host = g; final int wWidth = 700; final int wHeight = 600; this.setPreferredSize(new java.awt.Dimension(wWidth, wHeight)); this.setSize(wWidth, wHeight); this.setTitle("Deck Importer"); txtInput.setFocusable(true); txtInput.setEditable(true); FSkin.SkinColor foreColor = FSkin.getColor(FSkin.Colors.CLR_TEXT); this.scrollInput.setBorder(new FSkin.TitledSkinBorder(BorderFactory.createEtchedBorder(), "Paste or type a decklist", foreColor)); this.scrollOutput.setBorder(new FSkin.TitledSkinBorder(BorderFactory.createEtchedBorder(), "Expect the recognized lines to appear", foreColor)); this.scrollInput.setViewportBorder(BorderFactory.createLoweredBevelBorder()); this.scrollOutput.setViewportBorder(BorderFactory.createLoweredBevelBorder()); this.add(this.scrollInput, "cell 0 0, w 50%, growy, pushy"); this.add(this.newEditionCheck, "cell 0 1, w 50%, ax c"); this.add(this.dateTimeCheck, "cell 0 2, w 50%, ax c"); this.add(monthDropdown, "cell 0 3, w 20%, ax left, split 2, pad 0 4 0 0"); this.add(yearDropdown, "w 15%"); fillDateDropdowns(); this.add(this.onlyCoreExpCheck, "cell 0 4, w 50%, ax c"); this.add(this.scrollOutput, "cell 1 0, w 50%, growy, pushy"); this.add(this.summaryMain, "cell 1 1, label"); this.add(this.summarySide, "cell 1 2, label"); this.add(this.cmdAccept, "cell 1 4, split 2, w 150, align r, h 26"); this.add(this.cmdCancel, "w 150, h 26"); this.cmdCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { DeckImport.this.processWindowEvent(new WindowEvent(DeckImport.this, WindowEvent.WINDOW_CLOSING)); } }); this.cmdAccept.addActionListener(new ActionListener() { @SuppressWarnings("unchecked") @Override public void actionPerformed(final ActionEvent e) { final String warning = "This will replace contents of your currently open deck with whatever you are importing. Proceed?"; if (!FOptionPane.showConfirmDialog(warning, "Replacing old deck")) { return; } final Deck toSet = DeckImport.this.buildDeck(); DeckImport.this.host.getDeckController().setModel((TModel) toSet); DeckImport.this.processWindowEvent(new WindowEvent(DeckImport.this, WindowEvent.WINDOW_CLOSING)); } }); ActionListener updateDateCheck = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean isSel = dateTimeCheck.isSelected(); monthDropdown.setEnabled(isSel); yearDropdown.setEnabled(isSel); parseAndDisplay(); } }; this.dateTimeCheck.addActionListener(updateDateCheck); ActionListener reparse = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { parseAndDisplay(); } }; this.newEditionCheck.addActionListener(reparse); this.onlyCoreExpCheck.addActionListener(reparse); this.yearDropdown.addActionListener(reparse); this.monthDropdown.addActionListener(reparse); updateDateCheck.actionPerformed(null); // update actual state this.txtInput.getDocument().addDocumentListener(new OnChangeTextUpdate()); this.cmdAccept.setEnabled(false); }
From source file:com.unionpay.upmp.jmeterplugin.gui.UPMPDefaultsGui.java
private void init() { setLayout(new BorderLayout(0, 5)); setBorder(makeBorder());/*from www. j a v a 2s.c om*/ add(makeTitlePanel(), BorderLayout.NORTH); urlConfig = new UPMPUrlConfigGui(false, true, false); add(urlConfig, BorderLayout.CENTER); // OPTIONAL TASKS final JPanel optionalTasksPanel = new VerticalPanel(); optionalTasksPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils.getResString("optional_tasks"))); // $NON-NLS-1$ final JPanel checkBoxPanel = new HorizontalPanel(); imageParser = new JCheckBox(JMeterUtils.getResString("web_testing_retrieve_images")); // $NON-NLS-1$ checkBoxPanel.add(imageParser); imageParser.addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { enableConcurrentDwn(true); } else { enableConcurrentDwn(false); } } }); // Concurrent resources download concurrentDwn = new JCheckBox(JMeterUtils.getResString("web_testing_concurrent_download")); // $NON-NLS-1$ concurrentDwn.addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { if (imageParser.isSelected() && e.getStateChange() == ItemEvent.SELECTED) { concurrentPool.setEnabled(true); } else { concurrentPool.setEnabled(false); } } }); concurrentPool = new JTextField(2); // 2 columns size concurrentPool.setMaximumSize(new Dimension(30, 20)); checkBoxPanel.add(concurrentDwn); checkBoxPanel.add(concurrentPool); optionalTasksPanel.add(checkBoxPanel); // Embedded URL match regex embeddedRE = new JLabeledTextField(JMeterUtils.getResString("web_testing_embedded_url_pattern"), 30); // $NON-NLS-1$ optionalTasksPanel.add(embeddedRE); add(optionalTasksPanel, BorderLayout.SOUTH); }
From source file:api3.window.sound.panel.SoundPanel.java
public void plot(PanelData data, JFreeChart chart, JPanel plotPanel) { chart = ChartFactory.createXYLineChart(data.name, "prbka", "warto", data.dataset, PlotOrientation.VERTICAL, true, false, false); XYPlot plot = (XYPlot) chart.getPlot(); LOG.info("PLOTTING 1"); domainAxis = (NumberAxis) plot.getDomainAxis(); plot.addRangeMarker(new ValueMarker(0, Color.BLACK, new BasicStroke(1))); ChartPanel chartPanel = new ChartPanel(chart); Border border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createEtchedBorder()); chartPanel.setBorder(border);//from www. ja v a2 s . c om LOG.info("PLOTTING 2"); plotPanel.removeAll(); plotPanel.add(chartPanel); plotPanel.revalidate(); LOG.info("PLOTTING 3"); }
From source file:it.cnr.istc.iloc.gui.TimelinesChart.java
@Override public void currentNode(Solver.Node n) { final CombinedDomainXYPlot combined_plot = new CombinedDomainXYPlot(new DateAxis("Time")); combined_plot.setGap(3.0);//from ww w . j a v a 2 s . c o m combined_plot.setOrientation(PlotOrientation.VERTICAL); Set<Type> c_types = new HashSet<>(); LinkedList<Type> queue = new LinkedList<>(); queue.addAll(solver.getTypes()); while (!queue.isEmpty()) { Type c_type = queue.pollFirst(); if (!c_types.contains(c_type)) { c_types.add(c_type); queue.addAll(c_type.getTypes()); } } for (Type type : c_types) { if (visualizers.containsKey(type.getClass())) { for (XYPlot plot : visualizers.get(type.getClass()).getPlots(type)) { TextTitle title = new TextTitle(type.name, new Font("SansSerif", Font.PLAIN, 11), Color.BLACK, RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, new RectangleInsets(4, 4, 4, 4)); XYTitleAnnotation titleAnn = new XYTitleAnnotation(0.01, 1, title, RectangleAnchor.TOP_LEFT); plot.addAnnotation(titleAnn); combined_plot.add(plot, 1); } } } setChart(new JFreeChart("", new Font("SansSerif", Font.BOLD, 14), combined_plot, false)); setBorder(BorderFactory.createEtchedBorder()); }
From source file:ja.lingo.application.gui.main.describer.DescriberGui.java
public DescriberGui(Model model, Actions actions, IEngine engine, DropHandler dropHandler) { this.model = model; this.engine = engine; this.model.addApplicationModelListener(new ModelAdapter() { public void initialize(Preferences preferences) { cardPanel.show(welcomePanel); }/*from ww w. j a va 2 s.co m*/ public void translate(IArticle article, String highlight) { LOG.info("translating \"" + article.getTitle() + "\"..."); articlePanel.setArticle(article, highlight); cardPanel.show(describerPanel); } public void translateNotFound(String articleTitle) { articleNotFoundPanel.update(articleTitle, getClosestArticleTitleFor(articleTitle), !DescriberGui.this.engine.getFinder().isEmpty()); cardPanel.show(articleNotFoundPanel); } public void find(String text, boolean fromStart, boolean forwardDirection, boolean caseSensetive, boolean wholeWordsOnly) { DescriberGui.this.find(text, fromStart, forwardDirection, caseSensetive, wholeWordsOnly); } public void find_show() { showFindGui(); }; }); articlePanel = new ArticlePanel(engine, false); findGui = new FindGui(model); menu = new DescriberMenu(actions); menuOnSelect = new DescriberMenuOnSelect(engine); describerPanel = new JPanel(new BorderLayout()); describerPanel.add(articlePanel.getGui(), BorderLayout.CENTER); describerPanel.add(findGui.getGui(), BorderLayout.SOUTH); articleNotFoundPanel = new ArticleNotFoundPanel(model); welcomePanel = new WelcomePanel(actions); cardPanel = new CardPanel(); cardPanel.add(describerPanel); cardPanel.add(articleNotFoundPanel); cardPanel.add(welcomePanel); cardPanel.getGui().setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(0, 0, 0, 1))); articlePanel.getEditorPane().setTransferHandler(dropHandler); articleNotFoundPanel.getGui().setTransferHandler(dropHandler); welcomePanel.getGui().setTransferHandler(dropHandler); ActionBinder.bind(this); }