List of usage examples for javax.swing BorderFactory createEmptyBorder
public static Border createEmptyBorder(int top, int left, int bottom, int right)
From source file:MouseWheelEventDemo.java
public MouseWheelEventDemo() { super(new BorderLayout()); textArea = new JTextArea(); textArea.setEditable(false);/*from ww w . j a v a 2s .co m*/ scrollPane = new JScrollPane(textArea); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setPreferredSize(new Dimension(400, 250)); add(scrollPane, BorderLayout.CENTER); textArea.append("This text area displays information " + "about its mouse wheel events." + newline); //Register for mouse-wheel events on the text area. textArea.addMouseWheelListener(this); setPreferredSize(new Dimension(450, 350)); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:IconDisplayer.java
public IconDisplayer(Icon icon, int preferredNumImages, int pad) { this.icon = icon; if (preferredNumImages > 0) { this.preferredNumImages = preferredNumImages; }//from w ww .ja v a 2 s . co m if (pad >= 0) { this.pad = pad; } //Set a reasonable default border. if (this.pad > 0) { setBorder(BorderFactory.createEmptyBorder(this.pad, this.pad, this.pad, this.pad)); } }
From source file:jchrest.gui.Shell.java
public Shell(Chrest model) { super("jCHREST"); this._model = model; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); createMenuBar(0);/*ww w . jav a 2 s . c o m*/ JLabel startupInfo = new JLabel( "<html>Load data by clicking on the 'Data' toolbar option. Two types of data<br>" + "can be loaded:" + "<ul>" + " <li>Pre-experiment data: trains CHREST before undertaking an experiment.</li>" + " <li>Experiment data: loads an experiment for CHREST to undertake.</li>" + "</ul>" + "Note that only one set of experiment data can be used with CHREST at any<br>" + "time whereas multiple pre-experiment data files can be used.<br>" + "<br>" + "To reset CHREST and undertake a different experiment, select 'Model' then<br>" + "'Clear' from the toolbar. Clearing CHREST will remove any pre-experiment<br>" + "data learned too." + "</html>"); startupInfo.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); setContentPane(startupInfo); setSize(800, 600); setLocationRelativeTo(null); setTheme("Nimbus"); //_model.setNotLoadedIntoExperiment(); //_model.setNotEngagedInExperiment(); _model.addObserver(this); }
From source file:it.unibas.spicygui.vista.InstanceTreeTabbedPane.java
private void creaAlbero(INode instanceRoot, boolean source, MappingTask mappingTask) { if (logger.isDebugEnabled()) { logger.debug("Sto eseguendo creaAlbero"); }//from w ww . j a v a2s .c om IDataSourceProxy dataSource; if (source) { dataSource = mappingTask.getSourceProxy(); } else { dataSource = mappingTask.getTargetProxy(); } this.albero = treeCreator.buildInstanceTree(instanceRoot, dataSource); this.albero.setBorder((BorderFactory.createEmptyBorder(10, 10, 10, 10))); creaPopUp(); this.jScrollPane.setViewportView(albero); Utility.expandAll(albero); }
From source file:Main.java
public Main() { super(new BorderLayout()); task = new LongTask(); //Create the demo's UI. startButton = new JButton("Start"); startButton.setActionCommand("start"); startButton.addActionListener(this); taskOutput = new JTextArea(5, 20); taskOutput.setMargin(new Insets(5, 5, 5, 5)); taskOutput.setEditable(false);/* www . ja v a2 s . c o m*/ add(startButton, BorderLayout.PAGE_START); add(new JScrollPane(taskOutput), BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); //Create a timer. timer = new Timer(ONE_SECOND, new TimerListener()); }
From source file:brainflow.app.presentation.controls.FileObjectGroupSelector.java
public FileObjectGroupSelector(FileObject root) throws FileSystemException { if (root.getType() != FileType.FOLDER) { throw new IllegalArgumentException("root file must be a directory"); }/*from w w w.ja v a2s . c o m*/ rootFolder = root; explorer = new FileExplorer(rootFolder); explorer.getJTree().setRootVisible(false); explorer.getJTree().getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); setLayout(new BorderLayout()); Box topPanel = new Box(BoxLayout.X_AXIS); topPanel.setBorder(BorderFactory.createEmptyBorder(8, 12, 8, 8)); topPanel.add(regexLabel); topPanel.add(regexField); topPanel.add(Box.createHorizontalStrut(4)); topPanel.add(searchType); add(topPanel, BorderLayout.NORTH); //JPanel mainPanel = new JPanel(); //MigLayout layout = new MigLayout(""); // mainPanel.setLayout(layout); //add(regexLabel); //add(regexField, "gap left 0, growx"); //add(findButton, "align right, wrap"); //add(searchType, "wrap"); //add(createSplitPane(), "span 3, grow, wrap"); add(createSplitPane(), BorderLayout.CENTER); depthSpinner.setMaximumSize(new Dimension(50, 200)); depthSpinner.setModel(new SpinnerNumberModel(recursiveDepth, 0, 5, 1)); JPanel bottomPanel = new JPanel(); MigLayout layout = new MigLayout("", "[][grow]", "[][]"); bottomPanel.setLayout(layout); //bottomPanel.setBorder(BorderFactory.createEmptyBorder(4,12,8,8)); bottomPanel.add(new JLabel("Root Folder: ")); rootField.setEditable(false); rootField.setText(root.getName().getBaseName()); bottomPanel.add(rootField, "wrap, width 150:150:150"); bottomPanel.add(new JLabel("Search Depth: "), "gap top 8"); bottomPanel.add(depthSpinner, "width 35:45:55, wrap"); add(bottomPanel, BorderLayout.SOUTH); explorer.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { TreePath path = e.getPath(); Object[] obj = path.getPath(); Object lastNode = obj[obj.length - 1]; if (lastNode instanceof FileExplorer.FileObjectNode) { FileExplorer.FileObjectNode fnode = (FileExplorer.FileObjectNode) lastNode; try { if (fnode.getFileObject().getType() == FileType.FOLDER) { rootField.setText(fnode.getFileObject().getName().getBaseName()); rootFolder = fnode.getFileObject(); updateFileList(); } } catch (FileSystemException ex) { throw new RuntimeException(ex); } } } }); depthSpinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { recursiveDepth = ((Number) depthSpinner.getValue()).intValue(); updateFileList(); } }); regexField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateFileList(); System.out.println(Arrays.toString(explorer.getSelectedNodes().toArray())); } }); }
From source file:net.pickapack.chart.BarPlotFrame.java
/** * Create a bar plot frame./*from ww w . j a v a2 s . c om*/ * * @param barPlot the bar plot * @param domainAxisLabel the domain axis label * @param width the width * @param height the height */ public BarPlotFrame(BarPlot<ItemT> barPlot, String domainAxisLabel, int width, int height) { super(barPlot.getTitle()); DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); for (ItemT item : barPlot.getItems()) { if (barPlot.getPredicate().apply(item)) { for (SubBarPlot<ItemT> subBarPlot : barPlot.getSubBarPlots()) { dataSet.addValue(subBarPlot.getGetValueCallback().apply(item), subBarPlot.getTitle(), subBarPlot.getGetTitleCallback().apply(item)); } } } JFreeChart chart = barPlot.isStacked() ? ChartFactory.createStackedBarChart(barPlot.getTitle(), domainAxisLabel, barPlot.getTitleY(), dataSet, PlotOrientation.VERTICAL, true, true, false) : ChartFactory.createBarChart(barPlot.getTitle(), domainAxisLabel, barPlot.getTitleY(), dataSet, PlotOrientation.VERTICAL, true, true, false); CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); ChartPanel chartPanel = new ChartPanel(chart, false); chartPanel.setPreferredSize(new Dimension(width, height)); chartPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setContentPane(chartPanel); }
From source file:ProgressMonitorDemo.java
public ProgressMonitorDemo() { super(new BorderLayout()); task = new LongTask(); //Create the demo's UI. startButton = new JButton("Start"); startButton.setActionCommand("start"); startButton.addActionListener(this); taskOutput = new JTextArea(5, 20); taskOutput.setMargin(new Insets(5, 5, 5, 5)); taskOutput.setEditable(false);//from w ww. ja v a 2s . co m add(startButton, BorderLayout.PAGE_START); add(new JScrollPane(taskOutput), BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); //Create a timer. timer = new Timer(ONE_SECOND, new TimerListener()); }
From source file:components.SliderDemo.java
public SliderDemo() { setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); delay = 1000 / FPS_INIT;//from ww w . jav a2 s . c o m //Create the label. JLabel sliderLabel = new JLabel("Frames Per Second", JLabel.CENTER); sliderLabel.setAlignmentX(Component.CENTER_ALIGNMENT); //Create the slider. JSlider framesPerSecond = new JSlider(JSlider.HORIZONTAL, FPS_MIN, FPS_MAX, FPS_INIT); framesPerSecond.addChangeListener(this); //Turn on labels at major tick marks. framesPerSecond.setMajorTickSpacing(10); framesPerSecond.setMinorTickSpacing(1); framesPerSecond.setPaintTicks(true); framesPerSecond.setPaintLabels(true); framesPerSecond.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); Font font = new Font("Serif", Font.ITALIC, 15); framesPerSecond.setFont(font); //Create the label that displays the animation. picture = new JLabel(); picture.setHorizontalAlignment(JLabel.CENTER); picture.setAlignmentX(Component.CENTER_ALIGNMENT); picture.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(10, 10, 10, 10))); updatePicture(0); //display first frame //Put everything together. add(sliderLabel); add(framesPerSecond); add(picture); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); //Set up a timer that calls this object's action handler. timer = new Timer(delay, this); timer.setInitialDelay(delay * 7); //We pause animation twice per cycle //by restarting the timer timer.setCoalesce(true); }
From source file:org.esa.beam.timeseries.ui.graph.TimeSeriesGraphForm.java
private void createUI(JFreeChart chart, String helpID) { final TableLayout tableLayout = new TableLayout(2); tableLayout.setTablePadding(4, 4);// w w w. j a v a 2s. com tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST); tableLayout.setTableFill(TableLayout.Fill.BOTH); tableLayout.setTableWeightY(1.0); tableLayout.setColumnWeightX(0, 1.0); tableLayout.setColumnWeightX(1, 0.0); tableLayout.setRowWeightY(0, 1.0); tableLayout.setRowWeightY(1, 0.0); tableLayout.setCellRowspan(0, 1, 2); tableLayout.setCellFill(1, 0, TableLayout.Fill.HORIZONTAL); tableLayout.setCellPadding(1, 0, new Insets(5, 5, 5, 5)); mainPanel = new JPanel(tableLayout); mainPanel.setPreferredSize(new Dimension(320, 200)); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createBevelBorder(BevelBorder.LOWERED), BorderFactory.createEmptyBorder(2, 2, 2, 2))); mainPanel.add(chartPanel); mainPanel.add(createButtonPanel(helpID)); mainPanel.add(validatorUI.createUI()); }