public static void setBGP(JComponent comp, Painter painter) { if(comp instanceof JXPanel) { ((JXPanel)comp).setBackgroundPainter(painter); } if(comp instanceof JXButton) { ((JXButton)comp).setBackgroundPainter(painter); } } public static void setFGP(JComponent comp, Painter painter) {
JXPanel panel = new JXPanel(); ImagePainter image = new ImagePainter(myImage); image.setFilters( new AffineTransformOp(AffineTransform.getRotateInstance(-Math.PI * 2 / 8, 100, 100), null) ); panel.setBackgroundPainter(image);
public static void setBGP(JComponent comp, Painter painter) { if(comp instanceof JXPanel) { ((JXPanel)comp).setBackgroundPainter(painter); } if(comp instanceof JXButton) { ((JXButton)comp).setBackgroundPainter(painter); } } public static void setFGP(JComponent comp, Painter painter) {
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("title")) { caption.setText((String)evt.getNewValue()); } else if (evt.getPropertyName().equals("titleForeground")) { caption.setForeground((Color)evt.getNewValue()); } else if (evt.getPropertyName().equals("titleFont")) { caption.setFont((Font)evt.getNewValue()); } else if ("titlePainter".equals(evt.getPropertyName())) { topPanel.setBackgroundPainter(titledPanel.getTitlePainter()); topPanel.repaint(); } } };
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("title")) { caption.setText((String)evt.getNewValue()); } else if (evt.getPropertyName().equals("titleForeground")) { caption.setForeground((Color)evt.getNewValue()); } else if (evt.getPropertyName().equals("titleFont")) { caption.setFont((Font)evt.getNewValue()); } else if ("titlePainter".equals(evt.getPropertyName())) { topPanel.setBackgroundPainter(titledPanel.getTitlePainter()); topPanel.repaint(); } } };
public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("title")) { caption.setText((String)evt.getNewValue()); } else if (evt.getPropertyName().equals("titleForeground")) { caption.setForeground((Color)evt.getNewValue()); } else if (evt.getPropertyName().equals("titleFont")) { caption.setFont((Font)evt.getNewValue()); } else if ("titlePainter".equals(evt.getPropertyName())) { topPanel.setBackgroundPainter(titledPanel.getTitlePainter()); topPanel.repaint(); } } };
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("title")) { caption.setText((String)evt.getNewValue()); } else if (evt.getPropertyName().equals("titleForeground")) { caption.setForeground((Color)evt.getNewValue()); } else if (evt.getPropertyName().equals("titleFont")) { caption.setFont((Font)evt.getNewValue()); } else if ("titlePainter".equals(evt.getPropertyName())) { topPanel.setBackgroundPainter(titledPanel.getTitlePainter()); topPanel.repaint(); } } };
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("title")) { caption.setText((String)evt.getNewValue()); } else if (evt.getPropertyName().equals("titleForeground")) { caption.setForeground((Color)evt.getNewValue()); } else if (evt.getPropertyName().equals("titleFont")) { caption.setFont((Font)evt.getNewValue()); } else if ("titlePainter".equals(evt.getPropertyName())) { topPanel.setBackgroundPainter(titledPanel.getTitlePainter()); topPanel.repaint(); } } };
int rows = 10; int columns = 20; MigLayout layout = new MigLayout( // set the automatic wrap after columns "insets 0, wrap " + columns, // hardcode fixed column width and fixed column gap "[50lp, fill]5lp", // hardcode fixed height and a zero row gap "[20lp, fill]0"); JXPanel content = new JXPanel(layout); content.setBackgroundPainter(new ImagePainter(XTestUtils.loadDefaultImage("moon.jpg"))); for (int r = 0; r < rows; r++) { // top gap on even rows String topGap = r != 0 && r % 2 == 0 ? "gaptop 5lp" : ""; for (int i = 0; i < columns; i++) { JTextField field = new JTextField(); content.add(field, topGap); } } showInFrame(content, "grid");
protected JXPanel createAndConfigureTopPanel(JXTitledPanel titledPanel) { JXPanel topPanel = new JXPanel(); topPanel.setBackgroundPainter(titledPanel.getTitlePainter()); topPanel.setBorder(BorderFactory.createEmptyBorder()); topPanel.setLayout(new GridBagLayout()); topPanel.setOpaque(false); return topPanel; }
protected JXPanel createAndConfigureTopPanel(JXTitledPanel titledPanel) { JXPanel topPanel = new JXPanel(); topPanel.setBackgroundPainter(titledPanel.getTitlePainter()); topPanel.setBorder(BorderFactory.createEmptyBorder()); topPanel.setLayout(new GridBagLayout()); topPanel.setOpaque(false); return topPanel; }
JTextField name = new JTextField(20); name.setOpaque(false); JTextField pass = new JTextField(20); pass.setOpaque(false); pass.setForeground(Color.WHITE); // being lazy: use SwingX JXPanel panel = new JXPanel(); BufferedImage back = XTestUtils.loadDefaultImage("moon.jpg"); panel.setBackgroundPainter(new ImagePainter(back)); panel.add(name); panel.add(pass);
protected JXPanel createAndConfigureTopPanel(JXTitledPanel titledPanel) { JXPanel topPanel = new JXPanel(); topPanel.setBackgroundPainter(titledPanel.getTitlePainter()); topPanel.setBorder(BorderFactory.createEmptyBorder()); topPanel.setLayout(new GridBagLayout()); topPanel.setOpaque(false); return topPanel; }
protected JXPanel createAndConfigureTopPanel(JXTitledPanel titledPanel) { JXPanel topPanel = new JXPanel(); topPanel.setBackgroundPainter(titledPanel.getTitlePainter()); topPanel.setBorder(BorderFactory.createEmptyBorder()); topPanel.setLayout(new GridBagLayout()); topPanel.setOpaque(false); return topPanel; }
protected JXPanel createAndConfigureTopPanel(JXTitledPanel titledPanel) { JXPanel topPanel = new JXPanel(); topPanel.setBackgroundPainter(titledPanel.getTitlePainter()); topPanel.setBorder(BorderFactory.createEmptyBorder()); topPanel.setLayout(new GridBagLayout()); topPanel.setOpaque(false); return topPanel; }
public UniformityMeasurementsPanel() { try { assert EventQueue.isDispatchThread(); backgroundImage = ImageIO.read(getClass().getResource(IMAGE_RESOURCE)); painter = new ImagePainter(backgroundImage); painter.setScaleToFit(true); displayPanel.setOpaque(false); displayPanel.setBackgroundPainter(painter); final double imageAspectRatio = (double)backgroundImage.getWidth() / backgroundImage.getHeight(); setLayout(new FixedAspectRatioLayout(imageAspectRatio)); add(displayPanel); displayPanel.add(innerPanel); setOpaque(false); } catch (IOException e) { throw new RuntimeException(e); } }
public UniformityMeasurementsPanel() { try { assert EventQueue.isDispatchThread(); backgroundImage = ImageIO.read(getClass().getResource(IMAGE_RESOURCE)); painter = new ImagePainter(backgroundImage); painter.setScaleToFit(true); displayPanel.setOpaque(false); displayPanel.setBackgroundPainter(painter); final double imageAspectRatio = (double)backgroundImage.getWidth() / backgroundImage.getHeight(); setLayout(new FixedAspectRatioLayout(imageAspectRatio)); add(displayPanel); displayPanel.add(innerPanel); setOpaque(false); } catch (IOException e) { throw new RuntimeException(e); } }
public SimpleExplorerPanel() { assert EventQueue.isDispatchThread(); setLayout(new OverlayLayout(this)); busyLabel.setText("Loading..."); busyLabel.setHorizontalAlignment(SwingConstants.CENTER); final MattePainter painter = new MattePainter(new Color(255, 255, 255, 128)); // painter.setFilters(new GaussianBlurFilter(10)); shadingPanel.setVisible(false); shadingPanel.setOpaque(false); shadingPanel.setBackgroundPainter(painter); shadingPanel.add(busyLabel, BorderLayout.CENTER); add(shadingPanel); final ActionMap actionMap = getActionMap(); actionMap.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(explorerManager)); actionMap.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(explorerManager)); actionMap.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(explorerManager)); actionMap.put("delete", ExplorerUtils.actionDelete(explorerManager, true)); explorerManager.addPropertyChangeListener(pcl); }
public SimpleExplorerPanel() { assert EventQueue.isDispatchThread(); setLayout(new OverlayLayout(this)); busyLabel.setText("Loading..."); busyLabel.setHorizontalAlignment(SwingConstants.CENTER); final MattePainter painter = new MattePainter(new Color(255, 255, 255, 128)); // painter.setFilters(new GaussianBlurFilter(10)); shadingPanel.setVisible(false); shadingPanel.setOpaque(false); shadingPanel.setBackgroundPainter(painter); shadingPanel.add(busyLabel, BorderLayout.CENTER); add(shadingPanel); final ActionMap actionMap = getActionMap(); actionMap.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(explorerManager)); actionMap.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(explorerManager)); actionMap.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(explorerManager)); actionMap.put("delete", ExplorerUtils.actionDelete(explorerManager, true)); explorerManager.addPropertyChangeListener(pcl); }
legendMainPanel.setAlpha(.8f); legendMainPanel.setPreferredSize(LEGEND_DIMENSION); legendMainPanel.setBackgroundPainter(new CompoundPainter(matte, stripes)); legendMainPanel.add(legendTitlePanel); legendMainPanel.add(legendActionPanel);