private PreviewTopComponent() { initComponents(); setName(NbBundle.getMessage(PreviewTopComponent.class, "CTL_PreviewTopComponent")); // setToolTipText(NbBundle.getMessage(PreviewTopComponent.class, // "HINT_PreviewTopComponent")); setIcon(ImageUtilities.loadImage(ICON_PATH)); if (UIUtils.isAquaLookAndFeel()) { previewPanel.setBackground(UIManager.getColor("NbExplorerView.background")); } if (UIUtils.isAquaLookAndFeel()) { southToolbar.setBackground(UIManager.getColor("NbExplorerView.background")); } bannerPanel.setVisible(false); // inits the preview applet sketchPanel.add(sketch, BorderLayout.CENTER); sketch.init(); sketch.registerPost(processingListener); sketch.registerPre(processingListener); // forces the controller instanciation PreviewUIController.findInstance(); // background color ((JColorButton) backgroundButton) .addPropertyChangeListener( JColorButton.EVENT_COLOR, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { PreviewController controller = Lookup.getDefault().lookup(PreviewController.class); controller.setBackgroundColor((Color) evt.getNewValue()); } }); southBusyLabel.setVisible(false); resetZoomButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { sketch.resetZoom(); } }); }
public void setBackgroundColor(Color color) { ((JColorButton) backgroundButton).setColor(color); }
private PreviewTopComponent() { initComponents(); setName(NbBundle.getMessage(PreviewTopComponent.class, "CTL_PreviewTopComponent")); // setToolTipText(NbBundle.getMessage(PreviewTopComponent.class, // "HINT_PreviewTopComponent")); setIcon(ImageUtilities.loadImage(ICON_PATH)); if (UIUtils.isAquaLookAndFeel()) { previewPanel.setBackground(UIManager.getColor("NbExplorerView.background")); } if (UIUtils.isAquaLookAndFeel()) { southToolbar.setBackground(UIManager.getColor("NbExplorerView.background")); } bannerPanel.setVisible(false); // background color ((JColorButton) backgroundButton) .addPropertyChangeListener( JColorButton.EVENT_COLOR, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { PreviewController previewController = Lookup.getDefault().lookup(PreviewController.class); previewController .getModel() .getProperties() .putValue(PreviewProperty.BACKGROUND_COLOR, (Color) evt.getNewValue()); PreviewUIController previewUIController = Lookup.getDefault().lookup(PreviewUIController.class); previewUIController.refreshPreview(); } }); southBusyLabel.setVisible(false); resetZoomButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { target.resetZoom(); } }); plusButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { target.zoomPlus(); } }); minusButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { target.zoomMinus(); } }); PreviewUIController controller = Lookup.getDefault().lookup(PreviewUIController.class); controller.addPropertyChangeListener(this); PreviewUIModel m = controller.getModel(); if (m != null) { this.model = m; initTarget(model); } }