Lines 13-27
Link Here
|
13 |
|
13 |
|
14 |
package org.netbeans.modules.image; |
14 |
package org.netbeans.modules.image; |
15 |
|
15 |
|
|
|
16 |
import java.awt.AlphaComposite; |
17 |
import java.awt.BasicStroke; |
16 |
import java.awt.BorderLayout; |
18 |
import java.awt.BorderLayout; |
17 |
import java.awt.Color; |
19 |
import java.awt.Color; |
18 |
import java.awt.Component; |
20 |
import java.awt.Component; |
|
|
21 |
import java.awt.Cursor; |
19 |
import java.awt.Dimension; |
22 |
import java.awt.Dimension; |
|
|
23 |
import java.awt.FlowLayout; |
24 |
import java.awt.Font; |
20 |
import java.awt.Graphics; |
25 |
import java.awt.Graphics; |
|
|
26 |
import java.awt.Graphics2D; |
27 |
import java.awt.Point; |
28 |
import java.awt.GridLayout; |
21 |
import java.awt.Image; |
29 |
import java.awt.Image; |
22 |
import java.awt.Toolkit; |
30 |
import java.awt.Toolkit; |
23 |
import java.awt.event.ActionListener; |
31 |
import java.awt.event.ActionListener; |
24 |
import java.awt.event.ActionEvent; |
32 |
import java.awt.event.ActionEvent; |
|
|
33 |
import java.awt.geom.Line2D; |
34 |
import java.awt.geom.Ellipse2D; |
25 |
import java.beans.PropertyChangeEvent; |
35 |
import java.beans.PropertyChangeEvent; |
26 |
import java.beans.PropertyChangeListener; |
36 |
import java.beans.PropertyChangeListener; |
27 |
import java.io.IOException; |
37 |
import java.io.IOException; |
Lines 32-46
Link Here
|
32 |
import java.util.HashSet; |
42 |
import java.util.HashSet; |
33 |
import java.util.Iterator; |
43 |
import java.util.Iterator; |
34 |
import java.util.Set; |
44 |
import java.util.Set; |
|
|
45 |
import java.util.Observer; |
46 |
import java.util.Observable; |
35 |
import javax.swing.Action; |
47 |
import javax.swing.Action; |
|
|
48 |
import javax.swing.ButtonGroup; |
49 |
import javax.swing.event.ChangeEvent; |
50 |
import javax.swing.event.ChangeListener; |
36 |
import javax.swing.Icon; |
51 |
import javax.swing.Icon; |
37 |
import javax.swing.ImageIcon; |
52 |
import javax.swing.ImageIcon; |
38 |
import javax.swing.JButton; |
53 |
import javax.swing.JButton; |
|
|
54 |
import javax.swing.JColorChooser; |
55 |
import javax.swing.JFormattedTextField; |
39 |
import javax.swing.JLabel; |
56 |
import javax.swing.JLabel; |
|
|
57 |
import javax.swing.JOptionPane; |
40 |
import javax.swing.JPanel; |
58 |
import javax.swing.JPanel; |
41 |
import javax.swing.JScrollPane; |
59 |
import javax.swing.JScrollPane; |
|
|
60 |
import javax.swing.JSpinner; |
61 |
import javax.swing.JTextField; |
42 |
import javax.swing.JToggleButton; |
62 |
import javax.swing.JToggleButton; |
43 |
import javax.swing.JToolBar; |
63 |
import javax.swing.JToolBar; |
|
|
64 |
import javax.swing.SpinnerModel; |
65 |
import javax.swing.SpinnerNumberModel; |
44 |
|
66 |
|
45 |
import org.openide.filesystems.FileObject; |
67 |
import org.openide.filesystems.FileObject; |
46 |
import org.openide.filesystems.FileUtil; |
68 |
import org.openide.filesystems.FileUtil; |
Lines 57-66
Link Here
|
57 |
|
79 |
|
58 |
/** |
80 |
/** |
59 |
* Top component providing a viewer for images. |
81 |
* Top component providing a viewer for images. |
60 |
* @author Petr Hamernik, Ian Formanek, Lukas Tadial |
82 |
* @author Petr Hamernik, Ian Formanek, Lukas Tadial, Dragan Mandic, Jason Solomon |
61 |
* @author Marian Petras |
83 |
* @author Marian Petras |
62 |
*/ |
84 |
*/ |
63 |
public class ImageViewer extends CloneableTopComponent { |
85 |
public class ImageViewer extends CloneableTopComponent implements Observer { |
64 |
|
86 |
|
65 |
/** Serialized version UID. */ |
87 |
/** Serialized version UID. */ |
66 |
static final long serialVersionUID =6960127954234034486L; |
88 |
static final long serialVersionUID =6960127954234034486L; |
Lines 72-99
Link Here
|
72 |
private NBImageIcon storedImage; |
94 |
private NBImageIcon storedImage; |
73 |
|
95 |
|
74 |
/** Component showing image. */ |
96 |
/** Component showing image. */ |
75 |
private JPanel panel; |
97 |
private ImageDisplayEdit panel; |
76 |
|
98 |
|
77 |
/** Scale of image. */ |
99 |
/** Scale of image. */ |
78 |
private double scale = 1.0D; |
100 |
private double scale = 1.0D; |
79 |
|
101 |
|
80 |
/** On/off grid. */ |
|
|
81 |
private boolean showGrid = false; |
82 |
|
83 |
/** Increase/decrease factor. */ |
102 |
/** Increase/decrease factor. */ |
84 |
private final double changeFactor = Math.sqrt(2.0D); |
103 |
private final double changeFactor = Math.sqrt(2.0D); |
85 |
|
104 |
|
86 |
/** Grid color. */ |
|
|
87 |
private final Color gridColor = Color.black; |
88 |
|
89 |
/** Listens for name changes. */ |
105 |
/** Listens for name changes. */ |
90 |
private PropertyChangeListener nameChangeL; |
106 |
private PropertyChangeListener nameChangeL; |
91 |
|
107 |
|
92 |
/** collection of all buttons in the toolbar */ |
108 |
/** collection of all buttons in the toolbar */ |
93 |
private final Collection/*<JButton>*/ toolbarButtons |
109 |
private final Collection/*<JButton>*/ toolbarButtons |
94 |
= new ArrayList/*<JButton>*/(11); |
110 |
= new ArrayList/*<JButton>*/(11); |
|
|
111 |
/** All the custom cursors used in the ImageViewer */ |
112 |
private Cursor sprayCursor; |
113 |
private Cursor penCursor; |
114 |
private Cursor fillCursor; |
115 |
private Cursor brushCursor; |
116 |
|
117 |
|
118 |
private JToggleButton noFillRect; |
119 |
private JToggleButton fillRect; |
120 |
private JToggleButton noLineRect; |
121 |
|
122 |
private JToggleButton noFillEllipse; |
123 |
private JToggleButton fillEllipse; |
124 |
private JToggleButton noLineEllipse; |
125 |
|
126 |
private JToggleButton brushCircle; |
127 |
private JToggleButton brushSquare; |
128 |
private JToggleButton brushLeft; |
129 |
private JToggleButton brushRight; |
130 |
|
131 |
private JSpinner cornerRounding; |
132 |
private JSpinner toolSize; |
95 |
|
133 |
|
|
|
134 |
private JPanel cornerRoundingPanel; |
135 |
private JPanel linePanel; |
96 |
|
136 |
|
|
|
137 |
private JColorChooser fgColor = new JColorChooser(); |
138 |
private JColorChooser bgColor = new JColorChooser(); |
139 |
|
97 |
/** Default constructor. Must be here, used during de-externalization */ |
140 |
/** Default constructor. Must be here, used during de-externalization */ |
98 |
public ImageViewer () { |
141 |
public ImageViewer () { |
99 |
super(); |
142 |
super(); |
Lines 123-128
Link Here
|
123 |
TopComponent.NodeName.connect (this, obj.getNodeDelegate ()); |
166 |
TopComponent.NodeName.connect (this, obj.getNodeDelegate ()); |
124 |
|
167 |
|
125 |
storedObject = obj; |
168 |
storedObject = obj; |
|
|
169 |
|
170 |
/* Add an observer */ |
171 |
storedObject.addObserver(this); |
126 |
|
172 |
|
127 |
// force closing panes in all workspaces, default is in current only |
173 |
// force closing panes in all workspaces, default is in current only |
128 |
setCloseOperation(TopComponent.CLOSE_EACH); |
174 |
setCloseOperation(TopComponent.CLOSE_EACH); |
Lines 132-137
Link Here
|
132 |
|
178 |
|
133 |
/* compose the whole panel: */ |
179 |
/* compose the whole panel: */ |
134 |
JToolBar toolbar = createToolBar(); |
180 |
JToolBar toolbar = createToolBar(); |
|
|
181 |
JToolBar edittoolbar = createEditToolBar(); |
135 |
Component view; |
182 |
Component view; |
136 |
if (storedImage != null) { |
183 |
if (storedImage != null) { |
137 |
view = createImageView(); |
184 |
view = createImageView(); |
Lines 142-147
Link Here
|
142 |
setLayout(new BorderLayout()); |
189 |
setLayout(new BorderLayout()); |
143 |
add(view, BorderLayout.CENTER); |
190 |
add(view, BorderLayout.CENTER); |
144 |
add(toolbar, BorderLayout.NORTH); |
191 |
add(toolbar, BorderLayout.NORTH); |
|
|
192 |
add(edittoolbar, BorderLayout.WEST); |
145 |
|
193 |
|
146 |
getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(ImageViewer.class).getString("ACS_ImageViewer")); |
194 |
getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(ImageViewer.class).getString("ACS_ImageViewer")); |
147 |
|
195 |
|
Lines 155-207
Link Here
|
155 |
}; |
203 |
}; |
156 |
|
204 |
|
157 |
obj.addPropertyChangeListener(WeakListeners.propertyChange(nameChangeL, obj)); |
205 |
obj.addPropertyChangeListener(WeakListeners.propertyChange(nameChangeL, obj)); |
|
|
206 |
|
207 |
initialiseCustomCursors(); |
208 |
} |
209 |
|
210 |
/** Laods all the custom cursors */ |
211 |
private void initialiseCustomCursors(){ |
212 |
Toolkit tk = Toolkit.getDefaultToolkit(); |
213 |
sprayCursor = tk.createCustomCursor(new ImageIcon(getClass().getResource("/org/netbeans/modules/image/sprayCursor.gif")).getImage(), new Point(0, 13), "Airbrush"); // Local |
214 |
penCursor = tk.createCustomCursor(new ImageIcon(getClass().getResource("/org/netbeans/modules/image/penCursor.gif")).getImage(), new Point(1, 14), "Pencil"); // Local |
215 |
fillCursor = tk.createCustomCursor(new ImageIcon(getClass().getResource("/org/netbeans/modules/image/fillCursor.gif")).getImage(), new Point(1, 12), "Paint Bucket"); // Local |
216 |
brushCursor = tk.createCustomCursor(new ImageIcon(getClass().getResource("/org/netbeans/modules/image/brushCursor.gif")).getImage(), new Point(0, 14), "Brush"); // Local |
158 |
} |
217 |
} |
159 |
|
218 |
|
160 |
/** |
219 |
/** |
161 |
*/ |
220 |
*/ |
162 |
private Component createImageView() { |
221 |
private Component createImageView() { |
163 |
panel = new JPanel() { |
222 |
panel = new ImageDisplayEdit(storedImage, getScale()); |
164 |
protected void paintComponent(Graphics g) { |
|
|
165 |
super.paintComponent(g); |
166 |
g.drawImage( |
167 |
storedImage.getImage(), |
168 |
0, |
169 |
0, |
170 |
(int)(getScale () * storedImage.getIconWidth ()), |
171 |
(int)(getScale () * storedImage.getIconHeight ()), |
172 |
0, |
173 |
0, |
174 |
storedImage.getIconWidth(), |
175 |
storedImage.getIconHeight(), |
176 |
this |
177 |
); |
178 |
|
179 |
if(showGrid) { |
180 |
int x = (int)(getScale () * storedImage.getIconWidth ()); |
181 |
int y = (int)(getScale () * storedImage.getIconHeight ()); |
182 |
|
183 |
double gridDistance = getScale(); |
184 |
|
185 |
if(gridDistance < 2) |
186 |
// Disable painting of grid if no image pixels would be visible. |
187 |
return; |
188 |
|
189 |
g.setColor(gridColor); |
190 |
|
191 |
double actualDistance = gridDistance; |
192 |
for(int i = (int)actualDistance; i < x ;actualDistance += gridDistance, i = (int)actualDistance) { |
193 |
g.drawLine(i,0,i,(y-1)); |
194 |
} |
195 |
|
196 |
actualDistance = gridDistance; |
197 |
for(int j = (int)actualDistance; j < y; actualDistance += gridDistance, j = (int)actualDistance) { |
198 |
g.drawLine(0,j,(x-1),j); |
199 |
} |
200 |
} |
201 |
|
202 |
} |
203 |
|
204 |
}; |
205 |
storedImage.setImageObserver(panel); |
223 |
storedImage.setImageObserver(panel); |
206 |
panel.setPreferredSize(new Dimension(storedImage.getIconWidth(), storedImage.getIconHeight() )); |
224 |
panel.setPreferredSize(new Dimension(storedImage.getIconWidth(), storedImage.getIconHeight() )); |
207 |
JScrollPane scroll = new JScrollPane(panel); |
225 |
JScrollPane scroll = new JScrollPane(panel); |
Lines 344-353
Link Here
|
344 |
toolBar.addSeparator(new Dimension(11,2)); |
362 |
toolBar.addSeparator(new Dimension(11,2)); |
345 |
toolBar.add(button = getGridButton()); |
363 |
toolBar.add(button = getGridButton()); |
346 |
toolbarButtons.add(button); |
364 |
toolbarButtons.add(button); |
|
|
365 |
toolBar.addSeparator(new Dimension(11,2)); |
366 |
toolBar.add(button = getConvertButton()); |
367 |
toolbarButtons.add(button); |
347 |
|
368 |
|
348 |
return toolBar; |
369 |
return toolBar; |
349 |
} |
370 |
} |
350 |
|
371 |
|
|
|
372 |
//** Creates edittoolbar. */ |
373 |
private JToolBar createEditToolBar() |
374 |
{ |
375 |
ButtonGroup bgGroup = new javax.swing.ButtonGroup(); |
376 |
ButtonGroup bgLineWidth = new javax.swing.ButtonGroup(); |
377 |
ButtonGroup bgRect = new javax.swing.ButtonGroup(); |
378 |
ButtonGroup bgEllipse = new javax.swing.ButtonGroup(); |
379 |
ButtonGroup bgBrush = new javax.swing.ButtonGroup(); |
380 |
JToolBar editToolBar = new javax.swing.JToolBar(); |
381 |
editToolBar.setName (NbBundle.getBundle(ImageViewer.class).getString("ACSN_EditToolbar")); |
382 |
editToolBar.setOrientation(1); |
383 |
|
384 |
setLayout(null); |
385 |
|
386 |
editToolBar.setFloatable (false); |
387 |
|
388 |
JToggleButton selectTButton = new JToggleButton(); |
389 |
editToolBar.add(selectTButton = getSelectTButton()); |
390 |
selectTButton.setSelected(true); |
391 |
selectTButton.setSize(32,17); |
392 |
bgGroup.add(selectTButton); |
393 |
|
394 |
JToggleButton polygonTButton = new JToggleButton(); |
395 |
editToolBar.add(polygonTButton = getPolygonTButton()); |
396 |
bgGroup.add(polygonTButton); |
397 |
|
398 |
JToggleButton penTButton = new JToggleButton(); |
399 |
editToolBar.add(penTButton = getPenTButton()); |
400 |
bgGroup.add(penTButton); |
401 |
|
402 |
JToggleButton brushTButton = new JToggleButton(); |
403 |
editToolBar.add(brushTButton = getBrushTButton()); |
404 |
bgGroup.add(brushTButton); |
405 |
|
406 |
JToggleButton eraserTButton = new JToggleButton(); |
407 |
editToolBar.add(eraserTButton = getEraserTButton()); |
408 |
bgGroup.add(eraserTButton); |
409 |
|
410 |
JToggleButton arcTButton = new JToggleButton(); |
411 |
editToolBar.add(arcTButton = getArcTButton()); |
412 |
bgGroup.add(arcTButton); |
413 |
|
414 |
JToggleButton lineTButton = new JToggleButton(); |
415 |
editToolBar.add(lineTButton = getLineTButton()); |
416 |
bgGroup.add(lineTButton); |
417 |
|
418 |
JToggleButton rectangleTButton = new JToggleButton(); |
419 |
editToolBar.add(rectangleTButton = getRectangleTButton()); |
420 |
bgGroup.add(rectangleTButton); |
421 |
|
422 |
JToggleButton ovalTButton = new JToggleButton(); |
423 |
editToolBar.add(ovalTButton = getEllipseTButton()); |
424 |
bgGroup.add(ovalTButton); |
425 |
|
426 |
JToggleButton fillTButton = new JToggleButton(); |
427 |
editToolBar.add(fillTButton = getFillTButton()); |
428 |
bgGroup.add(fillTButton); |
429 |
|
430 |
JToggleButton sprayTButton = new JToggleButton(); |
431 |
editToolBar.add(sprayTButton = getSprayTButton()); |
432 |
bgGroup.add(sprayTButton); |
433 |
|
434 |
editToolBar.addSeparator(new Dimension(2,4)); |
435 |
|
436 |
JButton foregroundButton = new JButton(); |
437 |
editToolBar.add(foregroundButton = getForegroundButton()); |
438 |
|
439 |
editToolBar.addSeparator(new Dimension(2,2)); |
440 |
|
441 |
JButton backgroundButton = new JButton(); |
442 |
editToolBar.add(backgroundButton = getBackgroundButton()); |
443 |
|
444 |
editToolBar.addSeparator(new Dimension(2,4)); |
445 |
|
446 |
brushSquare = new JToggleButton(); |
447 |
editToolBar.add(brushSquare = getBrushSquareTButton()); |
448 |
brushSquare.setSelected(true); |
449 |
bgBrush.add(brushSquare); |
450 |
brushSquare.setVisible(false); |
451 |
|
452 |
brushCircle = new JToggleButton(); |
453 |
editToolBar.add(brushCircle = getBrushCircleTButton()); |
454 |
bgBrush.add(brushCircle); |
455 |
brushCircle.setVisible(false); |
456 |
|
457 |
brushRight = new JToggleButton(); |
458 |
editToolBar.add(brushRight = getBrushRightTButton()); |
459 |
bgBrush.add(brushRight); |
460 |
brushRight.setVisible(false); |
461 |
|
462 |
brushLeft = new JToggleButton(); |
463 |
editToolBar.add(brushLeft = getBrushLeftTButton()); |
464 |
bgBrush.add(brushLeft); |
465 |
brushLeft.setVisible(false); |
466 |
|
467 |
noFillRect = new JToggleButton(); |
468 |
editToolBar.add(noFillRect = getNoFillRectTButton()); |
469 |
bgRect.add(noFillRect); |
470 |
noFillRect.setSelected(true); |
471 |
noFillRect.setVisible(false); |
472 |
|
473 |
fillRect = new JToggleButton(); |
474 |
editToolBar.add(fillRect = getFillRectTButton()); |
475 |
bgRect.add(fillRect); |
476 |
fillRect.setVisible(false); |
477 |
|
478 |
noLineRect = new JToggleButton(); |
479 |
editToolBar.add(noLineRect = getNoLineRectTButton()); |
480 |
bgRect.add(noLineRect); |
481 |
noLineRect.setVisible(false); |
482 |
|
483 |
noFillEllipse = new JToggleButton(); |
484 |
editToolBar.add(noFillEllipse = getNoFillEllipseTButton()); |
485 |
bgEllipse.add(noFillEllipse); |
486 |
noFillEllipse.setSelected(true); |
487 |
noFillEllipse.setVisible(false); |
488 |
|
489 |
fillEllipse = new JToggleButton(); |
490 |
editToolBar.add(fillEllipse = getFillEllipseTButton()); |
491 |
bgEllipse.add(fillEllipse); |
492 |
fillEllipse.setVisible(false); |
493 |
|
494 |
noLineEllipse = new JToggleButton(); |
495 |
editToolBar.add(noLineEllipse = getNoLineEllipseTButton()); |
496 |
bgEllipse.add(noLineEllipse); |
497 |
noLineEllipse.setVisible(false); |
498 |
|
499 |
editToolBar.addSeparator(new Dimension(2,2)); |
500 |
|
501 |
linePanel = new JPanel(); |
502 |
linePanel.setLayout(null); |
503 |
|
504 |
SpinnerModel lineWidthModel = new SpinnerNumberModel(1, 1, 40, 1); |
505 |
toolSize = new JSpinner(lineWidthModel); |
506 |
|
507 |
toolSize.addChangeListener(new ChangeListener() { |
508 |
public void stateChanged(javax.swing.event.ChangeEvent evt) { |
509 |
panel.setLineWidth(((Integer)(toolSize.getValue())).intValue()); |
510 |
changeLine(); |
511 |
} |
512 |
}); |
513 |
toolSize.setSize(32,17); |
514 |
|
515 |
JFormattedTextField bs = ((JSpinner.DefaultEditor)toolSize.getEditor()).getTextField(); |
516 |
bs.setEditable(false); |
517 |
bs.setFont(new Font("Arial Narrow", 0, 10)); |
518 |
bs.setBackground(Color.white); |
519 |
|
520 |
linePanel.add(toolSize); |
521 |
linePanel.setVisible(false); |
522 |
|
523 |
cornerRoundingPanel = new JPanel(); |
524 |
cornerRoundingPanel.setLayout(null); |
525 |
|
526 |
SpinnerModel cornerRoundingModel = new SpinnerNumberModel(0, 0, 100, 5); |
527 |
cornerRounding = new JSpinner(cornerRoundingModel); |
528 |
cornerRounding.addChangeListener(new ChangeListener() { |
529 |
public void stateChanged(javax.swing.event.ChangeEvent evt) { |
530 |
panel.setRoundingFactor(((Integer)(cornerRounding.getValue())).intValue()); |
531 |
} |
532 |
}); |
533 |
cornerRounding.setSize(32,17); |
534 |
|
535 |
JFormattedTextField tf = ((JSpinner.DefaultEditor)cornerRounding.getEditor()).getTextField(); |
536 |
tf.setEditable(false); |
537 |
tf.setFont(new Font("Arial Narrow", 0, 10)); |
538 |
tf.setBackground(Color.white); |
539 |
|
540 |
cornerRoundingPanel.add(cornerRounding); |
541 |
cornerRoundingPanel.setVisible(false); |
542 |
|
543 |
editToolBar.add(linePanel); |
544 |
editToolBar.addSeparator(new Dimension(2,2)); |
545 |
editToolBar.add(cornerRoundingPanel); |
546 |
add(editToolBar); |
547 |
|
548 |
return editToolBar; |
549 |
} |
550 |
|
351 |
/** Updates the name and tooltip of this top component according to associated data object. */ |
551 |
/** Updates the name and tooltip of this top component according to associated data object. */ |
352 |
private void updateName () { |
552 |
private void updateName () { |
353 |
// update name |
553 |
// update name |
Lines 541-546
Link Here
|
541 |
SystemAction.get(ZoomInAction.class), |
741 |
SystemAction.get(ZoomInAction.class), |
542 |
SystemAction.get(ZoomOutAction.class), |
742 |
SystemAction.get(ZoomOutAction.class), |
543 |
SystemAction.get(CustomZoomAction.class), |
743 |
SystemAction.get(CustomZoomAction.class), |
|
|
744 |
SystemAction.get(ConvertToAction.class), |
544 |
null}, |
745 |
null}, |
545 |
oldValue); |
746 |
oldValue); |
546 |
} |
747 |
} |
Lines 609-614
Link Here
|
609 |
|
810 |
|
610 |
resizePanel(); |
811 |
resizePanel(); |
611 |
panel.repaint(0, 0, panel.getWidth(), panel.getHeight()); |
812 |
panel.repaint(0, 0, panel.getWidth(), panel.getHeight()); |
|
|
813 |
panel.setScale(scale); |
612 |
} |
814 |
} |
613 |
|
815 |
|
614 |
/** Return zooming factor.*/ |
816 |
/** Return zooming factor.*/ |
Lines 619-624
Link Here
|
619 |
/** Change proportion "out"*/ |
821 |
/** Change proportion "out"*/ |
620 |
private void scaleOut() { |
822 |
private void scaleOut() { |
621 |
scale = scale / changeFactor; |
823 |
scale = scale / changeFactor; |
|
|
824 |
panel.setScale(scale); |
622 |
} |
825 |
} |
623 |
|
826 |
|
624 |
/** Change proportion "in"*/ |
827 |
/** Change proportion "in"*/ |
Lines 632-637
Link Here
|
632 |
if (newComputedScale == oldComputedScale) |
835 |
if (newComputedScale == oldComputedScale) |
633 |
// Has to increase. |
836 |
// Has to increase. |
634 |
scale = newComputedScale + 1.0D; |
837 |
scale = newComputedScale + 1.0D; |
|
|
838 |
|
839 |
panel.setScale(scale); |
840 |
} |
841 |
|
842 |
public void convertTo() { |
843 |
try { |
844 |
storedObject.convertTo(this); |
845 |
} catch(IOException e) { |
846 |
JOptionPane.showMessageDialog(null, NbBundle.getMessage(ImageViewer.class, "MSG_CouldNotConvert"), NbBundle.getMessage(ImageViewer.class, "LBL_CouldNotConvert"), JOptionPane.ERROR_MESSAGE); |
847 |
} |
848 |
} |
849 |
|
850 |
public void update(Observable o, Object arg){ |
851 |
updateView(storedObject); |
852 |
panel.reload(storedImage); |
635 |
} |
853 |
} |
636 |
|
854 |
|
637 |
/** Gets zoom button. */ |
855 |
/** Gets zoom button. */ |
Lines 676-687
Link Here
|
676 |
button.setMnemonic(NbBundle.getBundle(ImageViewer.class).getString("ACS_Grid_BTN_Mnem").charAt(0)); |
894 |
button.setMnemonic(NbBundle.getBundle(ImageViewer.class).getString("ACS_Grid_BTN_Mnem").charAt(0)); |
677 |
button.addActionListener(new ActionListener() { |
895 |
button.addActionListener(new ActionListener() { |
678 |
public void actionPerformed(ActionEvent evt) { |
896 |
public void actionPerformed(ActionEvent evt) { |
679 |
showGrid = !showGrid; |
897 |
panel.toggleGrid(); |
680 |
panel.repaint(0, 0, panel.getWidth(), panel.getHeight()); |
898 |
panel.repaint(0, 0, panel.getWidth(), panel.getHeight()); |
681 |
} |
899 |
} |
682 |
}); |
900 |
}); |
683 |
|
901 |
|
684 |
return button; |
902 |
return button; |
|
|
903 |
} |
904 |
|
905 |
private JButton getConvertButton() { |
906 |
// PENDING buttons should have their own icons. |
907 |
JButton button = new JButton(NbBundle.getMessage(CustomZoomAction.class, "LBL_ConvertTo")); |
908 |
button.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(ImageViewer.class).getString("ACS_Convert_BTN")); |
909 |
button.addActionListener(new ActionListener() { |
910 |
public void actionPerformed(ActionEvent evt) { |
911 |
ConvertToAction sa = (ConvertToAction) SystemAction.get(ConvertToAction.class); |
912 |
sa.performAction(); |
913 |
} |
914 |
}); |
915 |
|
916 |
return button; |
917 |
} |
918 |
|
919 |
/** Gets ellipse button.*/ |
920 |
private JToggleButton getEllipseTButton() { |
921 |
JToggleButton ellipseTButton = new JToggleButton(); |
922 |
ellipseTButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_Ellipse")); |
923 |
ellipseTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/oval.gif"))); |
924 |
|
925 |
ellipseTButton.addActionListener(new ActionListener() { |
926 |
public void actionPerformed(ActionEvent evt) { |
927 |
panel.setToolType(ImageDisplayEdit.TOOL_ELLIPSE); |
928 |
panel.setCustomCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); |
929 |
setSubtoolsVisible(); |
930 |
} |
931 |
}); |
932 |
|
933 |
return ellipseTButton; |
934 |
} |
935 |
|
936 |
/** Gets rectangle button.*/ |
937 |
private JToggleButton getRectangleTButton(){ |
938 |
JToggleButton rectangleTButton = new JToggleButton(); |
939 |
rectangleTButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_Rectangle")); |
940 |
rectangleTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/rect.gif"))); |
941 |
|
942 |
rectangleTButton.addActionListener(new ActionListener() { |
943 |
public void actionPerformed(ActionEvent evt) { |
944 |
panel.setToolType(ImageDisplayEdit.TOOL_RECTANGLE); |
945 |
panel.setCustomCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); |
946 |
setSubtoolsVisible(); |
947 |
} |
948 |
}); |
949 |
|
950 |
return rectangleTButton; |
951 |
} |
952 |
|
953 |
/** Gets fill button.*/ |
954 |
private JToggleButton getFillTButton(){ |
955 |
JToggleButton fillTButton = new JToggleButton(); |
956 |
fillTButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_Fill")); |
957 |
fillTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/fill.gif"))); |
958 |
|
959 |
fillTButton.addActionListener(new ActionListener() { |
960 |
public void actionPerformed(ActionEvent evt) { |
961 |
panel.setToolType(ImageDisplayEdit.TOOL_FILL); |
962 |
panel.setCustomCursor(fillCursor); |
963 |
setSubtoolsVisible(); |
964 |
} |
965 |
}); |
966 |
|
967 |
return fillTButton; |
968 |
} |
969 |
|
970 |
/** Gets line button.*/ |
971 |
private JToggleButton getLineTButton(){ |
972 |
JToggleButton lineTButton = new JToggleButton(); |
973 |
lineTButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_Line")); |
974 |
lineTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/line.gif"))); |
975 |
|
976 |
lineTButton.addActionListener(new ActionListener() { |
977 |
public void actionPerformed(ActionEvent evt) { |
978 |
panel.setToolType(ImageDisplayEdit.TOOL_LINE); |
979 |
panel.setCustomCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); |
980 |
setSubtoolsVisible(); |
981 |
} |
982 |
}); |
983 |
|
984 |
return lineTButton; |
985 |
} |
986 |
|
987 |
/** Gets select button.*/ |
988 |
private JToggleButton getSelectTButton(){ |
989 |
JToggleButton selectTButton = new JToggleButton(); |
990 |
selectTButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_Select")); |
991 |
selectTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/arrow.gif"))); |
992 |
|
993 |
selectTButton.addActionListener(new ActionListener() { |
994 |
public void actionPerformed(ActionEvent evt) { |
995 |
panel.setToolType(ImageDisplayEdit.TOOL_DEFAULT); |
996 |
panel.setCustomCursor(new Cursor(Cursor.DEFAULT_CURSOR)); |
997 |
setSubtoolsVisible(); |
998 |
} |
999 |
}); |
1000 |
|
1001 |
return selectTButton; |
1002 |
} |
1003 |
|
1004 |
/** Gets polygon button.*/ |
1005 |
private JToggleButton getPolygonTButton(){ |
1006 |
JToggleButton polygonTButton = new JToggleButton(); |
1007 |
polygonTButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_Polygon")); |
1008 |
polygonTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/polygon.gif"))); |
1009 |
|
1010 |
polygonTButton.addActionListener(new ActionListener() { |
1011 |
public void actionPerformed(ActionEvent evt) { |
1012 |
panel.setToolType(ImageDisplayEdit.TOOL_POLYGON); |
1013 |
panel.setCustomCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); |
1014 |
setSubtoolsVisible(); |
1015 |
} |
1016 |
}); |
1017 |
|
1018 |
return polygonTButton; |
1019 |
} |
1020 |
|
1021 |
/** Gets pen button.*/ |
1022 |
private JToggleButton getPenTButton(){ |
1023 |
JToggleButton penTButton = new JToggleButton(); |
1024 |
penTButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_Pen")); |
1025 |
penTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/pen.gif"))); |
1026 |
|
1027 |
penTButton.addActionListener(new ActionListener() { |
1028 |
public void actionPerformed(ActionEvent evt) { |
1029 |
panel.setToolType(ImageDisplayEdit.TOOL_PEN); |
1030 |
panel.setCustomCursor(penCursor); |
1031 |
setSubtoolsVisible(); |
1032 |
} |
1033 |
}); |
1034 |
|
1035 |
return penTButton; |
1036 |
} |
1037 |
|
1038 |
/** Gets eraser button.*/ |
1039 |
private JToggleButton getEraserTButton(){ |
1040 |
JToggleButton eraserTButton = new JToggleButton(); |
1041 |
eraserTButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_Eraser")); |
1042 |
eraserTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/eraser.gif"))); |
1043 |
|
1044 |
eraserTButton.addActionListener(new ActionListener() { |
1045 |
public void actionPerformed(ActionEvent evt) { |
1046 |
panel.setToolType(ImageDisplayEdit.TOOL_ERASER); |
1047 |
panel.setCustomCursor (new Cursor(Cursor.CROSSHAIR_CURSOR)); |
1048 |
setSubtoolsVisible(); |
1049 |
} |
1050 |
}); |
1051 |
|
1052 |
return eraserTButton; |
1053 |
} |
1054 |
|
1055 |
/** Gets brush button.*/ |
1056 |
private JToggleButton getBrushTButton(){ |
1057 |
JToggleButton brushTButton = new JToggleButton(); |
1058 |
brushTButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_Brush")); |
1059 |
brushTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/brush.gif"))); |
1060 |
|
1061 |
brushTButton.addActionListener(new ActionListener() { |
1062 |
public void actionPerformed(ActionEvent evt) { |
1063 |
panel.setToolType(ImageDisplayEdit.TOOL_BRUSH); |
1064 |
panel.setCustomCursor(brushCursor); |
1065 |
setSubtoolsVisible(); |
1066 |
} |
1067 |
}); |
1068 |
|
1069 |
return brushTButton; |
1070 |
} |
1071 |
|
1072 |
/** Gets arc button.*/ |
1073 |
private JToggleButton getArcTButton(){ |
1074 |
JToggleButton arcTButton = new JToggleButton(); |
1075 |
arcTButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_Arc")); |
1076 |
arcTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/arc.gif"))); |
1077 |
|
1078 |
arcTButton.addActionListener(new ActionListener() { |
1079 |
public void actionPerformed(ActionEvent evt) { |
1080 |
panel.setToolType(ImageDisplayEdit.TOOL_ARC); |
1081 |
panel.setCustomCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); |
1082 |
setSubtoolsVisible(); |
1083 |
} |
1084 |
}); |
1085 |
|
1086 |
return arcTButton; |
685 |
} |
1087 |
} |
686 |
|
1088 |
|
|
|
1089 |
/** Gets spray button.*/ |
1090 |
private JToggleButton getSprayTButton(){ |
1091 |
JToggleButton sprayTButton = new JToggleButton(); |
1092 |
sprayTButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_Spray")); |
1093 |
sprayTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/spray.gif"))); |
1094 |
|
1095 |
sprayTButton.addActionListener(new ActionListener() { |
1096 |
public void actionPerformed(ActionEvent evt) { |
1097 |
panel.setToolType(ImageDisplayEdit.TOOL_SPRAY); |
1098 |
panel.setCustomCursor(sprayCursor); |
1099 |
setSubtoolsVisible(); |
1100 |
} |
1101 |
}); |
1102 |
|
1103 |
return sprayTButton; |
1104 |
} |
1105 |
|
1106 |
/** Gets foreground button.*/ |
1107 |
private JButton getForegroundButton(){ |
1108 |
final JButton foregroundButton = new JButton(" "); |
1109 |
foregroundButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_SetLineColor")); |
1110 |
foregroundButton.setBackground(panel.getDefaultPrimaryColor()); |
1111 |
foregroundButton.addActionListener(new ActionListener() |
1112 |
{ |
1113 |
public void actionPerformed(ActionEvent evt) |
1114 |
{ |
1115 |
Color newColor = fgColor.showDialog(null,"Choose Foreground Color", foregroundButton.getForeground()); |
1116 |
foregroundButton.setBackground(newColor); |
1117 |
|
1118 |
panel.setPrimaryColor(newColor); |
1119 |
} |
1120 |
}); |
1121 |
|
1122 |
return foregroundButton; |
1123 |
} |
1124 |
|
1125 |
/** Gets background button.*/ |
1126 |
private JButton getBackgroundButton(){ |
1127 |
final JButton backgroundButton = new JButton(" "); |
1128 |
backgroundButton.setBackground(panel.getDefaultSecondaryColor()); |
1129 |
backgroundButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_SetFillColor")); |
1130 |
backgroundButton.addActionListener(new ActionListener() |
1131 |
{ |
1132 |
public void actionPerformed(ActionEvent evt) |
1133 |
{ |
1134 |
Color newColor = bgColor.showDialog(null,"Choose Background Color", backgroundButton.getBackground()); |
1135 |
backgroundButton.setBackground(newColor); |
1136 |
|
1137 |
panel.setSecondayColor(newColor); |
1138 |
} |
1139 |
}); |
1140 |
|
1141 |
return backgroundButton; |
1142 |
} |
1143 |
|
1144 |
|
1145 |
/** Gets noFillRect button */ |
1146 |
private JToggleButton getNoFillRectTButton(){ |
1147 |
JToggleButton noFillRectTButton = new JToggleButton(); |
1148 |
noFillRectTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/noFillRect.gif"))); |
1149 |
|
1150 |
noFillRectTButton.addActionListener(new ActionListener() { |
1151 |
public void actionPerformed(ActionEvent evt) { |
1152 |
panel.setSubTool(ImageDisplayEdit.SUB_LINEONLY); |
1153 |
} |
1154 |
}); |
1155 |
|
1156 |
return noFillRectTButton; |
1157 |
} |
1158 |
|
1159 |
/** Gets fillRect button */ |
1160 |
private JToggleButton getFillRectTButton(){ |
1161 |
JToggleButton fillRectTButton = new JToggleButton(); |
1162 |
fillRectTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/fillRect.gif"))); |
1163 |
|
1164 |
fillRectTButton.addActionListener(new ActionListener() { |
1165 |
public void actionPerformed(ActionEvent evt) { |
1166 |
panel.setSubTool(ImageDisplayEdit.SUB_BOTH); |
1167 |
} |
1168 |
}); |
1169 |
|
1170 |
return fillRectTButton; |
1171 |
} |
1172 |
|
1173 |
/** Gets noLineRect button */ |
1174 |
private JToggleButton getNoLineRectTButton(){ |
1175 |
JToggleButton noLineRectTButton = new JToggleButton(); |
1176 |
noLineRectTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/noLineRect.gif"))); |
1177 |
|
1178 |
noLineRectTButton.addActionListener(new ActionListener() { |
1179 |
public void actionPerformed(ActionEvent evt) { |
1180 |
panel.setSubTool(ImageDisplayEdit.SUB_FILLONLY); |
1181 |
} |
1182 |
}); |
1183 |
|
1184 |
return noLineRectTButton; |
1185 |
} |
1186 |
|
1187 |
/** Gets noFillEllipse button */ |
1188 |
private JToggleButton getNoFillEllipseTButton(){ |
1189 |
JToggleButton noFillEllipseTButton = new JToggleButton(); |
1190 |
noFillEllipseTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/noFillEllipse.gif"))); |
1191 |
|
1192 |
noFillEllipseTButton.addActionListener(new ActionListener() { |
1193 |
public void actionPerformed(ActionEvent evt) { |
1194 |
panel.setSubTool(ImageDisplayEdit.SUB_LINEONLY); |
1195 |
} |
1196 |
}); |
1197 |
|
1198 |
return noFillEllipseTButton; |
1199 |
} |
1200 |
|
1201 |
/** Gets fillEllipse button */ |
1202 |
private JToggleButton getFillEllipseTButton(){ |
1203 |
JToggleButton fillEllipseTButton = new JToggleButton(); |
1204 |
fillEllipseTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/fillEllipse.gif"))); |
1205 |
|
1206 |
fillEllipseTButton.addActionListener(new ActionListener() { |
1207 |
public void actionPerformed(ActionEvent evt) { |
1208 |
panel.setSubTool(ImageDisplayEdit.SUB_BOTH); |
1209 |
} |
1210 |
}); |
1211 |
|
1212 |
return fillEllipseTButton; |
1213 |
} |
1214 |
|
1215 |
/** Gets noLineEllipse button */ |
1216 |
private JToggleButton getNoLineEllipseTButton(){ |
1217 |
JToggleButton noLineEllipseTButton = new JToggleButton(); |
1218 |
noLineEllipseTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/noLineEllipse.gif"))); |
1219 |
|
1220 |
noLineEllipseTButton.addActionListener(new ActionListener() { |
1221 |
public void actionPerformed(ActionEvent evt) { |
1222 |
panel.setSubTool(ImageDisplayEdit.SUB_FILLONLY); |
1223 |
} |
1224 |
}); |
1225 |
|
1226 |
return noLineEllipseTButton; |
1227 |
} |
1228 |
|
1229 |
/** Gets brushSquare button */ |
1230 |
private JToggleButton getBrushSquareTButton(){ |
1231 |
JToggleButton brushSquareTButton = new JToggleButton(); |
1232 |
brushSquareTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/brushSquare.gif"))); |
1233 |
|
1234 |
brushSquareTButton.addActionListener(new ActionListener() { |
1235 |
public void actionPerformed(ActionEvent evt) { |
1236 |
panel.setBrushType(BitmapFreehandBrush.BRUSH_BOX); |
1237 |
} |
1238 |
}); |
1239 |
|
1240 |
return brushSquareTButton; |
1241 |
} |
1242 |
|
1243 |
/** Gets brushCircle button */ |
1244 |
private JToggleButton getBrushCircleTButton(){ |
1245 |
JToggleButton brushCircleTButton = new JToggleButton(); |
1246 |
brushCircleTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/brushCircle.gif"))); |
1247 |
|
1248 |
brushCircleTButton.addActionListener(new ActionListener() { |
1249 |
public void actionPerformed(ActionEvent evt) { |
1250 |
panel.setBrushType(BitmapFreehandBrush.BRUSH_CIRC); |
1251 |
} |
1252 |
}); |
1253 |
|
1254 |
return brushCircleTButton; |
1255 |
} |
1256 |
|
1257 |
/** Gets brushLongLeftTButton button */ |
1258 |
private JToggleButton getBrushLeftTButton(){ |
1259 |
JToggleButton brushLeftTButton = new JToggleButton(); |
1260 |
brushLeftTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/brushLeft.gif"))); |
1261 |
|
1262 |
brushLeftTButton.addActionListener(new ActionListener() { |
1263 |
public void actionPerformed(ActionEvent evt) { |
1264 |
panel.setBrushType(BitmapFreehandBrush.BRUSH_LINE_135); |
1265 |
} |
1266 |
}); |
1267 |
|
1268 |
return brushLeftTButton; |
1269 |
} |
1270 |
|
1271 |
/** Gets brushLongRightTButton button */ |
1272 |
private JToggleButton getBrushRightTButton(){ |
1273 |
JToggleButton brushRightTButton = new JToggleButton(); |
1274 |
brushRightTButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/image/brushRight.gif"))); |
1275 |
|
1276 |
brushRightTButton.addActionListener(new ActionListener() { |
1277 |
public void actionPerformed(ActionEvent evt) { |
1278 |
panel.setBrushType(BitmapFreehandBrush.BRUSH_LINE_45); |
1279 |
} |
1280 |
}); |
1281 |
|
1282 |
return brushRightTButton; |
1283 |
} |
1284 |
|
1285 |
/** changes the line width display */ |
1286 |
private void changeLine() { |
1287 |
Graphics2D g = (Graphics2D)linePanel.getGraphics(); |
1288 |
|
1289 |
g.setColor(Color.WHITE); |
1290 |
g.fillRect(0, 20, 32, 40); |
1291 |
g.setClip(0, 20, 32, 40); |
1292 |
|
1293 |
if (panel.getToolType() == ImageDisplayEdit.TOOL_SPRAY){ |
1294 |
g.setColor(Color.BLACK); |
1295 |
Ellipse2D testEllipse = new Ellipse2D.Float(10 - (panel.getLineWidth() / 2), 34 - (panel.getLineWidth() / 2), (float)panel.getLineWidth() + 10, (float)panel.getLineWidth() + 10); |
1296 |
g.draw(testEllipse); |
1297 |
}else{ |
1298 |
g.setColor(Color.BLACK); |
1299 |
Line2D testLine = new Line2D.Float(new Point(0, 40), new Point(32, 40)); |
1300 |
g.setStroke(new BasicStroke(panel.getLineWidth())); |
1301 |
g.draw(testLine); |
1302 |
} |
1303 |
} |
1304 |
|
1305 |
/** set the lines widths visible */ |
1306 |
private void setSubtoolsVisible(){ |
1307 |
if (panel.getToolType() == ImageDisplayEdit.TOOL_RECTANGLE){ |
1308 |
noFillRect.setVisible(true); |
1309 |
fillRect.setVisible(true); |
1310 |
noLineRect.setVisible(true); |
1311 |
cornerRoundingPanel.setVisible(true); |
1312 |
}else{ |
1313 |
noFillRect.setVisible(false); |
1314 |
fillRect.setVisible(false); |
1315 |
noLineRect.setVisible(false); |
1316 |
cornerRoundingPanel.setVisible(false); |
1317 |
} |
1318 |
|
1319 |
if (panel.getToolType() == ImageDisplayEdit.TOOL_ELLIPSE){ |
1320 |
noFillEllipse.setVisible(true); |
1321 |
fillEllipse.setVisible(true); |
1322 |
noLineEllipse.setVisible(true); |
1323 |
}else{ |
1324 |
noFillEllipse.setVisible(false); |
1325 |
fillEllipse.setVisible(false); |
1326 |
noLineEllipse.setVisible(false); |
1327 |
} |
1328 |
|
1329 |
if (panel.getToolType() == ImageDisplayEdit.TOOL_BRUSH){ |
1330 |
brushCircle.setVisible(true); |
1331 |
brushSquare.setVisible(true);; |
1332 |
brushLeft.setVisible(true); |
1333 |
brushRight.setVisible(true); |
1334 |
}else{ |
1335 |
brushCircle.setVisible(false); |
1336 |
brushSquare.setVisible(false);; |
1337 |
brushLeft.setVisible(false); |
1338 |
brushRight.setVisible(false); |
1339 |
} |
1340 |
|
1341 |
switch (panel.getToolType()){ |
1342 |
case ImageDisplayEdit.TOOL_POLYGON: |
1343 |
case ImageDisplayEdit.TOOL_BRUSH: |
1344 |
case ImageDisplayEdit.TOOL_ARC: |
1345 |
case ImageDisplayEdit.TOOL_LINE: |
1346 |
case ImageDisplayEdit.TOOL_RECTANGLE: |
1347 |
case ImageDisplayEdit.TOOL_ELLIPSE: |
1348 |
case ImageDisplayEdit.TOOL_ERASER: |
1349 |
case ImageDisplayEdit.TOOL_SPRAY: |
1350 |
linePanel.setVisible(true); |
1351 |
changeLine(); |
1352 |
break; |
1353 |
default: |
1354 |
linePanel.setVisible(false); |
1355 |
break; |
1356 |
} |
1357 |
} |
687 |
} |
1358 |
} |