mbien commented on code in PR #7171:
URL: https://github.com/apache/netbeans/pull/7171#discussion_r1531639360
##########
platform/core.windows/src/org/netbeans/core/windows/view/EditorView.java:
##########
@@ -257,6 +250,64 @@ public void dropActionChanged(DropTargetDragEvent dtde) {
setOpaque( false);
}
+ private JComponent initBackgroundComponent() {
+ JComponent imageComponent = null;
+ String imageSource = Constants.SWITCH_IMAGE_SOURCE; // NOI18N
+ if (imageSource == null) {
+ FileObject config =
FileUtil.getConfigFile("Windows2/Background");
+ if (config != null) {
+ Object attr = config.getAttribute("backgroundImage");
+ if (attr instanceof String) {
+ imageSource = (String) attr;
+ }
+ }
+ }
+ if (imageSource != null) {
+ Image image = ImageUtilities.loadImage(imageSource);
+ if (image != null) {
+ JLabel label = new
JLabel(ImageUtilities.image2Icon(image));
+ label.setMinimumSize(new Dimension(0, 0)); // XXX To be
able shrink the area.
+ imageComponent = label;
+ } else {
+
Logger.getLogger(EditorView.class.getName()).log(Level.WARNING, null,
+ new java.lang.NullPointerException("Image not
found at "
+ + imageSource)); // NOI18N
+ }
+ }
+ JComponent actionsComponent = initBackgroundActions();
+ if (actionsComponent != null) {
+ JPanel panel = new JPanel(new GridBagLayout());
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.ipadx = 50;
+ if (imageComponent != null) {
+ panel.add(imageComponent, gbc);
+ }
+ panel.add(actionsComponent, gbc);
+ return panel;
+ } else {
+ return imageComponent;
+ }
+ }
+
+ private JComponent initBackgroundActions() {
+ java.util.List<? extends Action> actions
Review Comment:
nitpick: you might be able to import `List` if the awt `*` imports are
cleaned up. Star imports are a bit of a red flag anyway from pre-IDE times.
##########
platform/core.windows/src/org/netbeans/core/windows/view/EditorView.java:
##########
@@ -257,6 +250,64 @@ public void dropActionChanged(DropTargetDragEvent dtde) {
setOpaque( false);
}
+ private JComponent initBackgroundComponent() {
+ JComponent imageComponent = null;
+ String imageSource = Constants.SWITCH_IMAGE_SOURCE; // NOI18N
+ if (imageSource == null) {
+ FileObject config =
FileUtil.getConfigFile("Windows2/Background");
+ if (config != null) {
+ Object attr = config.getAttribute("backgroundImage");
+ if (attr instanceof String) {
+ imageSource = (String) attr;
+ }
+ }
+ }
+ if (imageSource != null) {
+ Image image = ImageUtilities.loadImage(imageSource);
+ if (image != null) {
+ JLabel label = new
JLabel(ImageUtilities.image2Icon(image));
+ label.setMinimumSize(new Dimension(0, 0)); // XXX To be
able shrink the area.
+ imageComponent = label;
+ } else {
+
Logger.getLogger(EditorView.class.getName()).log(Level.WARNING, null,
+ new java.lang.NullPointerException("Image not
found at "
Review Comment:
nitpick: `java.lang.` is redundant here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists