List of usage examples for javax.swing BorderFactory createCompoundBorder
public static CompoundBorder createCompoundBorder(Border outsideBorder, Border insideBorder)
From source file:Main.java
public Main() { getContentPane().setLayout(new FlowLayout()); JLabel labelTwo = new JLabel("www.java2s.com"); labelTwo.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED, Color.red, Color.black)); add(labelTwo);/* ww w .ja va2 s.c om*/ JLabel labelThree = new JLabel("MatteBorder"); labelThree.setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink)); add(labelThree); JLabel labelFour = new JLabel("TitledBorder"); labelFour.setBorder( BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink), "Title", TitledBorder.RIGHT, TitledBorder.BOTTOM)); add(labelFour); JLabel labelSix = new JLabel("CompoundBorder"); Border one = BorderFactory.createEtchedBorder(); Border two = BorderFactory.createMatteBorder(4, 4, 4, 4, Color.blue); labelSix.setBorder(BorderFactory.createCompoundBorder(one, two)); add(labelSix); }
From source file:Main.java
public Main(String name) { getContentPane().setLayout(new FlowLayout()); JLabel labelTwo = new JLabel("www.java2s.com"); labelTwo.setBorder(BorderFactory.createEtchedBorder()); add(labelTwo);//w w w . ja v a2s . co m JLabel labelThree = new JLabel("MatteBorder"); labelThree.setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink)); add(labelThree); JLabel labelFour = new JLabel("TitledBorder"); labelFour.setBorder(BorderFactory.createTitledBorder( BorderFactory.createMatteBorder(10, 10, 10, 10, MetalIconFactory.getFileChooserHomeFolderIcon()), "Title", TitledBorder.RIGHT, TitledBorder.BOTTOM)); add(labelFour); JLabel labelSix = new JLabel("CompoundBorder"); Border one = BorderFactory.createEtchedBorder(); Border two = BorderFactory.createMatteBorder(4, 4, 4, 4, Color.blue); labelSix.setBorder(BorderFactory.createCompoundBorder(one, two)); add(labelSix); }
From source file:Main.java
public CustomPanel(Color c) { setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10), BorderFactory.createLineBorder(Color.black, 1))); setBackground(c);// w w w . j a va 2 s.c om }
From source file:com.github.fritaly.dualcommander.Utils.java
public static Border createRaisedBevelBorder() { return BorderFactory.createCompoundBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED), Utils.createEmptyBorder(1)); }
From source file:JSplash.java
private void init() { JPanel pnlImage = new JPanel(); ImageIcon image = new ImageIcon(getClass().getResource("img/logo.jpg")); JLabel lblBack = new JLabel(image); Border raisedbevel = BorderFactory.createRaisedBevelBorder(); Border loweredbevel = BorderFactory.createLoweredBevelBorder(); lblBack.setBounds(0, 0, image.getIconWidth(), image.getIconHeight()); getLayeredPane().add(lblBack, new Integer(Integer.MIN_VALUE)); pnlImage.setLayout(null);// ww w . j ava2 s. c om pnlImage.setOpaque(false); pnlImage.setBorder(BorderFactory.createCompoundBorder(raisedbevel, loweredbevel)); pnlImage.add(this.lblVersion); this.lblVersion.setForeground(Color.white); this.lblVersion.setFont(new Font("Dialog", Font.PLAIN, 12)); this.lblVersion.setBounds(15, 69, 120, 20); setContentPane(pnlImage); setSize(image.getIconWidth(), image.getIconHeight()); }
From source file:com.tencent.wstt.apt.chart.PieChart.java
public PieChart() { super(new BorderLayout()); chart = createChart();//from w w w .ja v a2 s. co m final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); this.add(chartPanel); }
From source file:ch.zhaw.ias.dito.ui.util.SingleHistogramPanel.java
public SingleHistogramPanel(Matrix m) { super(new BorderLayout()); this.m = m;/*from ww w. j av a 2 s.c o m*/ this.chart = createChart(); this.chartPanel = new ChartPanel(this.chart); Border border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createEtchedBorder()); this.chartPanel.setBorder(border); add(this.chartPanel, BorderLayout.CENTER); JPanel dashboard = new JPanel(new BorderLayout()); dashboard.setBorder(BorderFactory.createEmptyBorder(0, 4, 4, 4)); this.spinner = new JSpinner(new SpinnerNumberModel(0, 0, m.getColCount() - 1, 1)); spinner.addChangeListener(this); this.slider = new JSlider(0, m.getColCount() - 1, 0); slider.setPaintLabels(true); slider.setMajorTickSpacing(Math.max(50, 10 * Math.round(m.getColCount() / 100))); slider.setPaintTicks(true); this.slider.addChangeListener(this); FormLayout layout = new FormLayout("fill:0:g, max(20dlu; pref)", "top:pref"); CellConstraints cc = new CellConstraints(); DefaultFormBuilder fb = new DefaultFormBuilder(layout, Translation.INSTANCE.getBundle()); fb.add(slider, cc.xy(1, 1)); fb.add(spinner, cc.xy(2, 1)); dashboard.add(fb.getPanel(), BorderLayout.CENTER); add(dashboard, BorderLayout.SOUTH); switchColumn(0); }
From source file:ExtendedParagraphExample.java
public static void createDocumentStyles(StyleContext sc) { Style defaultStyle = sc.getStyle(StyleContext.DEFAULT_STYLE); // Create and add the main document style Style mainStyle = sc.addStyle(mainStyleName, defaultStyle); StyleConstants.setLeftIndent(mainStyle, 16); StyleConstants.setRightIndent(mainStyle, 16); StyleConstants.setFirstLineIndent(mainStyle, 16); StyleConstants.setFontFamily(mainStyle, "serif"); StyleConstants.setFontSize(mainStyle, 12); // Create and add the constant width style Style cwStyle = sc.addStyle(charStyleName, null); StyleConstants.setFontFamily(cwStyle, "monospaced"); StyleConstants.setForeground(cwStyle, Color.white); // Create and add the heading style Style heading2Style = sc.addStyle(heading2StyleName, null); StyleConstants.setForeground(heading2Style, Color.red); StyleConstants.setFontSize(heading2Style, 16); StyleConstants.setFontFamily(heading2Style, "serif"); StyleConstants.setBold(heading2Style, true); StyleConstants.setLeftIndent(heading2Style, 8); StyleConstants.setFirstLineIndent(heading2Style, 0); // Create and add the extended para styles Style paraStyle = sc.addStyle(paraStyleName, null); Color bgColor = Color.gray; ExtendedStyleConstants.setParagraphBackground(paraStyle, bgColor); ExtendedStyleConstants.setParagraphBorder(paraStyle, BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2), BorderFactory.createCompoundBorder( BorderFactory.createEtchedBorder(bgColor.brighter(), bgColor.darker()), BorderFactory.createEmptyBorder(4, 4, 4, 4)))); }
From source file:jesse.GA_ANN.DataVis.java
JFreeChart createChart()//Here Input MillSecond { total = new XYSeries[10]; XYSeriescollection = new XYSeriesCollection(); for (int i = 0; i < 10; i++) { total[i] = new XYSeries(i); XYSeriescollection.addSeries(total[i]); }//from ww w . j a va 2 s. c o m dateaxis = new NumberAxis("Time"); NumberAxis Conaxis = new NumberAxis("z??"); dateaxis.setAutoRange(true); dateaxis.setLowerMargin(0.0D); dateaxis.setUpperMargin(0.0D); dateaxis.setTickLabelsVisible(true); xylineandshaperenderer = new XYLineAndShapeRenderer(true, false); xylineandshaperenderer.setSeriesPaint(0, Color.green); xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(1F, 0, 2)); xylineandshaperenderer.setFillPaint(new Color(30, 30, 220), true); Conaxis.setRange(-1, 1); Conaxis.setAutoRange(true); Conaxis.setAutoRangeIncludesZero(false); XYPlot xyplot = new XYPlot(XYSeriescollection, dateaxis, Conaxis, xylineandshaperenderer); JFreeChart jfreechart = new JFreeChart("time-z", new Font("Arial", 1, 24), xyplot, true); ChartUtilities.applyCurrentTheme(jfreechart); ChartPanel chartpanel = new ChartPanel(jfreechart, true); chartpanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); return jfreechart; }
From source file:GetApplets.java
private void createGUI() { JPanel contentPane = new JPanel(new BorderLayout()); contentPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK), BorderFactory.createEmptyBorder(10, 10, 10, 10))); setContentPane(contentPane);/*from www.ja v a 2 s . c o m*/ JButton b = new JButton("Click to call getApplets()"); b.addActionListener(this); add(b, BorderLayout.PAGE_START); textArea = new JTextArea(5, 40); textArea.setEditable(false); JScrollPane scroller = new JScrollPane(textArea); add(scroller, BorderLayout.CENTER); }