[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool ToolFactory.java, 1.107, 1.108 Rotati
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2010-05-20 12:02:15
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv9273/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java RotationTool.java Removed Files: RotationToolB.java Log Message: Removed original RotationTool Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** ToolFactory.java 13 Jan 2010 10:58:30 -0000 1.107 --- ToolFactory.java 20 May 2010 12:02:06 -0000 1.108 *************** *** 75,79 **** private AbstractTool protractor; private FinalMoveTool moving; ! private RotationToolB rotation; private OffsetTool offset; private ExtrusionTool extrude; --- 75,79 ---- private AbstractTool protractor; private FinalMoveTool moving; ! private RotationTool rotation; private OffsetTool offset; private ExtrusionTool extrude; *************** *** 146,150 **** eraser = new EraserTool(editor, pencilcursor); arc = new ArcTool(editor, pencilcursor); ! rotation = new RotationToolB(editor, null); extrude = new ExtrusionTool(editor, pencilcursor); extend = new ExtendTool(editor, pencilcursor); --- 146,150 ---- eraser = new EraserTool(editor, pencilcursor); arc = new ArcTool(editor, pencilcursor); ! rotation = new RotationTool(editor, null); extrude = new ExtrusionTool(editor, pencilcursor); extend = new ExtendTool(editor, pencilcursor); --- RotationToolB.java DELETED --- Index: RotationTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RotationTool.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** RotationTool.java 5 Feb 2010 13:32:59 -0000 1.37 --- RotationTool.java 20 May 2010 12:02:06 -0000 1.38 *************** *** 5,265 **** // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- - package net.sourceforge.bprocessor.gl.tool; - - import net.sourceforge.bprocessor.gl.Editor; - import net.sourceforge.bprocessor.gl.model.GlObject; - import net.sourceforge.bprocessor.gl.model.Intersection; - import net.sourceforge.bprocessor.gui.GUI; ! import net.sourceforge.bprocessor.model.Camera; ! import net.sourceforge.bprocessor.model.Edge; ! import net.sourceforge.bprocessor.model.Geometry; ! import net.sourceforge.bprocessor.model.Line; ! import net.sourceforge.bprocessor.model.Plane; ! import net.sourceforge.bprocessor.model.Project; ! import net.sourceforge.bprocessor.model.Selection; ! import net.sourceforge.bprocessor.model.Surface; ! import net.sourceforge.bprocessor.model.Vertex; import java.awt.Cursor; import java.awt.event.MouseEvent; ! ! import java.text.MessageFormat; ! import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; - import java.util.Set; ! import javax.media.opengl.GL; ! import javax.media.opengl.glu.GLU; ! import org.apache.log4j.Logger; /** ! * The rotation tool */ public class RotationTool extends AbstractPencil { ! /** The logger */ ! private static Logger log = Logger.getLogger(RotationTool.class); ! ! /** The vertexes to rotate */ ! private Set<Vertex> vertices = new HashSet(); ! /** The first pressed point */ ! private Vertex p1; ! /** The secondly pressed point*/ ! private Vertex p2; ! /** The starting rotation point*/ ! private Vertex from; ! /** the previous vertex when moving the mouse */ ! private Vertex previous; ! /** The plane whose normal is rotated around */ ! private Plane onto; ! /** The gl object drawing the rotation circle */ ! private GlProtractor pro; ! /** The total rotation angle */ ! private double totalAngle; ! /** The set of object not to hit */ ! private Set nothits = new HashSet(); ! /** ! * The Constructor ! * @param editor The 3D canvas ! * @param cursor The cursor */ public RotationTool(Editor editor, Cursor cursor) { super(editor, cursor); } - - /** - * Invoked when a mouse button has been pressed on a component. - * @param e The MouseEvent object - */ - protected void pressed(MouseEvent e) { - process(e); - } - /** ! * @param e MouseEvent */ ! protected void moved(MouseEvent e) { ! current = findIntersection(e); ! if (current != null) { ! if (previous != null) { ! //find the angle to rotate ! Vertex to = onto.projection(current.vertex()); ! double angle = (previous.minus(p1).angle(to.minus(p1))); ! if ((previous.minus(p1).cross(to.minus(p1))).angle(p2.minus(p1)) > 0) { ! angle *= -1; ! } ! if (!(new Double(angle).isNaN())) { ! totalAngle = (totalAngle + angle) % (2 * Math.PI); ! rotate(angle); ! } ! previous = to; ! } } - updateFeedback(); } ! /** ! * Invoked when a mouse button has been released on a component. ! * @param e The MouseEvent ! */ ! protected void released(MouseEvent e) { ! } ! /** ! * Update the length field ! */ ! protected void updateLength() { ! double angle = 0; ! if (p1 != null && p2 != null && from != null && current != null) { ! angle = Math.toDegrees(totalAngle); ! editor.setLengthValue(MessageFormat.format("{0,number,###.##}", ! new Object[]{new Double(Math.round(angle * 100.0) / 100.0)})); } } ! /** ! * On Vertex ! */ ! public void onVertex() { ! process(null); } /** ! * Process click ! * @param e MouseEvent */ ! private void process(MouseEvent e) { ! if (Selection.primary().isEmpty()) { ! GUI.getInstance().alert("There is no selection to rotate"); } else { ! vertices = Selection.primary().collect(); ! if (p1 == null) { ! if (current.type() == Intersection.EDGE) { ! p1 = current.vertex(); ! p2 = p1.add(((Edge)current.object()).getDirection()); ! initDisk(); ! active = false; ! } else if (current.type() == Intersection.SURFACE) { ! p1 = current.vertex(); ! p2 = p1.add(((Surface)(current.object())).normal()); ! initDisk(); ! active = false; ! } else { ! p1 = current.vertex(); ! start = current; ! totalAngle = 0; ! active = true; ! setTip(secondClickTip()); } - } else if (p2 == null) { - p2 = current.vertex(); - start = null; - initDisk(); - active = false; - } else if (from == null) { - current = findIntersection(e); - from = onto.projection(current.vertex()); - previous = from; - pro.setStart(from); - nothits = getAffected(vertices); - setTip(fourthClickTip()); - } else { - finish(); } - updateFeedback(); } } - /** ! * Initialize the gldisk */ ! private void initDisk() { ! Vertex v = p2.minus(p1); ! v.normalize(); ! onto = new Plane(v.getX(), v.getY(), v.getZ(), p1); ! log.info("Disk were: " + onto); ! pro = new GlProtractor(onto, p1); ! editor.getView().addGlObjects3D(pro); ! setTip(thirdClickTip()); } ! /** ! * Finish off the tool ! */ ! private void finish() { ! Project.getInstance().checkpoint(); ! Project.getInstance().changed(vertices); ! active = false; ! clear(); } ! ! /** ! * Escape ! */ ! public void escape() { ! if (totalAngle != 0) { ! rotate(-totalAngle); } - cleanUp(); } /** ! * Apply current tool with specified length value ! * @param length The lengthfield value */ ! public void apply(double length) { ! int sign = 1; ! if (totalAngle < 0) { ! sign = -1; } - rotate(sign * (Math.toRadians(length * 1000) - Math.abs(totalAngle))); - finish(); } ! /** ! * Update the feedback */ ! private void updateFeedback() { ! List<Vertex> points = new LinkedList<Vertex>(); ! List edges = new LinkedList(); ! if (p1 != null) { ! points.add(p1); ! if (p2 != null) { ! Line l = new Line(p1, p2.minus(p1)); ! l.setActive(true); ! edges.add(l); ! edges.add(onto); ! if (from != null) { ! edges.addAll(Selection.primary()); } - } else { - Line l = new Line(p1, current.vertex().minus(p1)); - l.setActive(true); - edges.add(l); } } ! List temp = new LinkedList(); ! temp.addAll(nothits); ! temp.addAll(edges); ! temp.addAll(points); ! excluded(temp); ! points(points); feedback(edges); makeTarget(current); updateConstructors(); } ! /** ! * Remove tool specific things at tool change */ ! public void cleanUp() { ! super.cleanUp(); ! clear(); ! updateFeedback(); } --- 5,365 ---- // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- ! package net.sourceforge.bprocessor.gl.tool; import java.awt.Cursor; + import java.awt.Insets; + import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; ! import java.net.URL; ! import java.util.Collection; ! import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; import java.util.List; ! import javax.swing.AbstractAction; ! import javax.swing.Action; ! import javax.swing.ButtonGroup; ! import javax.swing.ImageIcon; ! import javax.swing.JComponent; ! import javax.swing.JToggleButton; ! import net.sourceforge.bprocessor.gl.Editor; ! import net.sourceforge.bprocessor.model.CoordinateSystem; ! import net.sourceforge.bprocessor.model.Edge; ! import net.sourceforge.bprocessor.model.Geometric; ! import net.sourceforge.bprocessor.model.Geometry; ! import net.sourceforge.bprocessor.model.Plane; ! import net.sourceforge.bprocessor.model.Project; ! import net.sourceforge.bprocessor.model.Selection; ! import net.sourceforge.bprocessor.model.Vertex; /** ! * */ public class RotationTool extends AbstractPencil { ! private List<Vertex> vertices; ! private List<Vertex> originals; ! ! private Collection<Geometric> affected; ! ! private CoordinateSystem system; ! private Protract protract; ! private Vertex base; ! private int mode; ! ! /** */ ! public static final int ONE = 1; ! ! /** */ ! public static final int TWO = 2; ! ! /** */ ! public static final int THREE = 3; ! ! /** ! * ! * @param editor Editor ! * @param cursor Cursor */ public RotationTool(Editor editor, Cursor cursor) { super(editor, cursor); + showConstructors = false; + mode = ONE; } /** ! * */ ! public void onVertex() { ! } ! ! private void cache() { ! originals = new LinkedList(); ! for (Vertex current : vertices) { ! originals.add(current.copy()); } } + + private void reset() { + Iterator<Vertex> actual = vertices.iterator(); + Iterator<Vertex> original = originals.iterator(); + while (actual.hasNext()) { + Vertex current = actual.next(); + Vertex value = original.next(); + current.set(value); + } + } + ! private void rotateIt(Vertex center, Vertex axis, double angle, Vertex vertex) { ! Geometry.rotate(angle, axis.getX(), axis.getY(), axis.getZ(), vertex, center); } ! private Vertex rotate(Vertex axis, double angle, Vertex vector) { ! Vertex u = vector.copy(); ! Vertex zero = new Vertex(0, 0, 0); ! rotateIt(zero, axis, angle, u); ! return u; ! } ! ! private void rotateIt(Vertex center, Vertex axis, double angle, Collection<Vertex> vertices) { ! for (Vertex current : vertices) { ! rotateIt(center, axis, angle, current); ! } ! for (Vertex current : vertices) { ! current.update(); } } ! private void finish() { ! base = null; ! Project.getInstance().checkpoint(); ! Project.getInstance().changed(vertices); ! cache(); ! excluded(Collections.EMPTY_LIST); } /** ! * {@inheritDoc} */ ! protected void moved(MouseEvent e) { ! if (vertices == null) { ! findTarget(e); } else { ! if (affected != null && base != null) { ! excluded(affected); ! } ! current = findIntersection(e); ! if (current != null) { ! if (system != null) { ! if (base != null) { ! process(); ! } } } } + updateFeedback(); } /** ! * {@inheritDoc} */ ! protected void pressed(MouseEvent e) { ! if (vertices == null) { ! if (target != null) { ! activate((Geometric) target); ! } ! } else { ! if (affected != null && base != null) { ! excluded(affected); ! } ! current = findIntersection(e); ! if (current != null) { ! if (system != null) { ! if (base == null) { ! base = current.vertex().copy(); ! } else { ! process(); ! finish(); ! } ! } else { ! if (start == null) { ! start = current; ! } else { ! Vertex origin = start.vertex(); ! Vertex to = current.vertex(); ! Vertex n = to.minus(origin); ! if (!n.isZero()) { ! n.normalize(); ! system = CoordinateSystem.systemFor(origin, n); ! start = null; ! } ! } ! } ! updateFeedback(); ! } ! } } + + + + + private void process() { + Vertex center = system.getOrigin(); + Vertex up = system.getN(); + Vertex from = base; + Vertex to = current.vertex(); + + Vertex u = from.minus(center); + u.normalize(); + Vertex v = to.minus(center); + v.normalize(); + + double alpha = angle(up, u, v); + + if (mode == ONE) { + if (!Double.isNaN(alpha)) { + reset(); + rotateIt(center, up, alpha, vertices); + } + } else if (mode == TWO) { + u = rotate(up, alpha, u); + Vertex axis = up.cross(u); + double beta = angle(axis, u, v); ! if (!Double.isNaN(alpha) && !Double.isNaN(beta)) { ! reset(); ! rotateIt(center, up, alpha, vertices); ! rotateIt(center, axis, beta, vertices); ! } ! } } ! ! private Vertex direction(Vertex original) { ! Plane plane = system.plane(); ! Vertex vertex = plane.projection(original); ! Vertex u = vertex.minus(system.getOrigin()); ! u.normalize(); ! return u; ! } ! ! private Vertex base() { ! if (base != null) { ! return direction(base); ! ! } else { ! return system.getI(); } } + + + private Vertex project(Vertex normal, Vertex vector) { + Vertex n = normal.copy(); + double t = vector.dot(normal); + n.scaleIt(t / n.length()); + vector = vector.minus(n); + return vector; + } + + private double angle(Vertex normal, Vertex v1, Vertex v2) { + Vertex i = project(normal, v1); + Vertex u = project(normal, v2); + if (i.cross(u).isZero()) { + return 0; + } else { + + double angle = i.angle(u); + double box = i.cross(u).dot(normal); + if (box < 0) { + angle = -angle; + } + return angle; + } + } + + private Vertex vector(Vertex point) { + Vertex v = point.minus(system.getOrigin()); + if (!v.isZero()) { + v.normalize(); + } + return v; + } + + + private Vertex axis() { + Vertex up = system.getN(); + Vertex forward; + if (base == null) { + forward = system.getI(); + } else { + forward = vector(base); + } + Vertex axis = up.cross(forward); + return axis; + } + + private double angle(Vertex axis) { + Vertex v1; + if (base == null) { + v1 = system.getI(); + } else { + v1 = vector(base); + } + return angle(axis, v1, vector(current.vertex())); + } + /** ! * {@inheritDoc} */ ! protected void updateLength() { ! if (system != null) { ! double angle = angle(system.getN()) * 180 / Math.PI; ! setLength(angle / 1000); ! } else { ! clearLength(); } } ! /** ! * Update feedback */ ! protected void updateFeedback() { ! if (protract != null) { ! editor.getView().removeGlObjects3D(protract); ! protract = null; ! } ! ! List<Edge> edges = new LinkedList(); ! ! if (vertices != null) { ! if (current != null) { ! if (system != null) { ! showConstructors = false; ! Vertex center = system.getOrigin(); ! Vertex i = base(); ! Vertex j = system.getN().cross(i); ! protract = new Protract(center, i, j, true); ! editor.getView().addGlObjects3D(protract); ! ! ! if (base != null) { ! Edge e1 = new Edge(center, base); ! e1.setStrippled(true); ! edges.add(e1); ! Edge e2 = new Edge(center, current.vertex()); ! e2.setStrippled(true); ! edges.add(e2); ! } ! } else { ! showConstructors = true; ! if (start != null) { ! Vertex origin = start.vertex(); ! Vertex to = current.vertex(); ! Edge axis = new Edge(origin, to); ! axis.setStrippled(true); ! edges.add(axis); ! } } } + } else { + editor.getView().makeTarget(target); } ! feedback(edges); makeTarget(current); updateConstructors(); } ! /** ! * {@inheritDoc} */ ! public void apply(double value) { ! if (protract != null) { ! double angle = (value * 1000) * Math.PI / 180; ! rotateIt(system.getOrigin(), system.getN(), angle, vertices); ! finish(); ! } } *************** *** 269,479 **** public void prepare() { setLabel("Angle:"); } ! ! /** ! * Remove all internal stuff ! */ ! private void clear() { ! vertices.clear(); ! totalAngle = 0; ! p1 = null; ! p2 = null; ! start = null; ! current = null; ! incident = null; ! from = null; ! onto = null; ! editor.getView().removeGlObjects3D(pro); ! pro = null; ! previous = null; ! nothits.clear(); ! } ! /** ! * Do the rotation of the vertices ! * @param angle the angle to rotate in degrees */ ! private void rotate(double angle) { ! for (Vertex v : vertices) { ! Vertex n = onto.normal(); ! Geometry.rotate(angle, n.getX(), ! n.getY(), n.getZ(), v, p1); ! v.update(); } } ! /** ! * A GlObject that draw a protactor on the gl */ ! class GlProtractor implements GlObject { ! /** The location for the protractor */ ! private Plane plane; ! /** The center of the protractor */ ! private Vertex origin; ! /** The vertex the rotation starts from */ ! private Vertex start; ! /** The preset angles to intersect with */ ! private LinkedList < Line > edges; ! /** The magnification factor */ ! private double factor; ! ! /** ! * The construtor for the protractor ! * @param p The location for the protractor ! * @param origin The center for the protractor ! */ ! public GlProtractor(Plane p, Vertex origin) { ! plane = p; ! this.origin = origin; ! edges = new LinkedList < Line > (); ! } ! ! /** ! * Setter for the start vertex ! * @param start the first vertex in the rotation ! */ ! public void setStart(Vertex start) { ! this.start = start; ! double i = 0; ! double increment = Math.PI / 12; ! while (i < Math.PI) { ! Vertex to = start.copy(); ! Vertex n = plane.normal(); ! Geometry.rotate(i, n.getX(), n.getY(), n.getZ(), to, origin); ! Edge e = new Edge(origin, to); ! edges.add(new Line(origin, e.getDirection())); ! i += increment; ! } ! } ! ! /** ! * @inheritDoc ! */ ! public void draw(GL gl) { ! double angle = Math.toDegrees(totalAngle); ! Camera cam = Project.getInstance().getCurrentCamera(); ! Vertex camorig = new Vertex(cam.getCamera()); ! double dist = camorig.distance(plane.origin()); ! factor = dist / 20; ! GLU glu = new GLU(); ! // translate ! Vertex z = plane.normal(); ! Vertex y = new Vertex(0, 1, 0); ! if (y.cross(z).length() < 0.00001) { ! y = new Vertex(1, 0, 0); ! } ! ! // place the axis right ! if (start != null) { ! y = start.minus(origin); ! y.normalize(); ! } ! Vertex x = y.cross(z); ! x.normalize(); ! y = z.cross(x); ! double[] m = new double[]{x.getX(), x.getY(), x.getZ(), 0, ! y.getX(), y.getY(), y.getZ(), 0, ! z.getX(), z.getY(), z.getZ(), 0, ! origin.getX(), origin.getY(), origin.getZ(), 1}; ! gl.glPushMatrix(); ! gl.glMultMatrixd(m, 0); ! //draw ! ! gl.glColor4fv(new float[] {0.5f, 0.5f, 0.5f, 0.6f}, 0); ! int sign = 1; ! if (angle < 0) { ! sign = -1; ! } ! glu.gluPartialDisk( ! glu.gluNewQuadric(), 0, 2 * factor, 360, 1, 0, sign * (360 - Math.abs(angle))); ! gl.glColor4fv(new float[] {0.0f, 0.0f, 1.0f, 1.0f}, 0); ! glu.gluPartialDisk(glu.gluNewQuadric(), 0, 2.2 * factor, 360, 1, 0, -angle); ! //restore matrix ! gl.glPopMatrix(); ! } ! ! /** {@inheritDoc} */ ! public void select(GL gl) { ! draw(gl); ! } ! ! /** {@inheritDoc} */ ! public List<Vertex> handles() { ! return new LinkedList(); ! } ! ! /** ! * @inheritDoc ! */ ! public Intersection intersection(Edge e) { ! Vertex i = plane.intersection(e); ! Iterator<Line> iter = edges.iterator(); ! double p1 = -2.5 * factor; ! double p2 = 2.5 * factor; ! while (iter.hasNext()) { ! Line l = iter.next(); ! Edge tmp = new Edge(l.getPointAt(p1), l.getPointAt(p2)); ! Edge con = e.shortestEdge(tmp); ! if (con.getLength() < 0.1) { ! if (tmp.coincides(con.getFrom())) { ! i = con.getFrom(); ! } else if (tmp.coincides(con.getTo())) { ! i = con.getTo(); ! } ! } ! } ! return new Intersection(i, Intersection.PLANE_INTERSECTION, plane); ! } ! ! /** ! * @inheritDoc ! */ ! public Plane getPlane() { ! return plane; ! } ! ! /** ! * @inheritDoc ! */ ! public boolean contains(Vertex v) { ! return getPlane().contains(v); ! } } /** ! * Tip on how to set the first click ! * @return short describtion of what to do */ public String initialTip() { ! return "Use select tool to select object(s) to rotate," + ! " then pick a center point for the rotation"; } /** ! * Tip on how to set the second click ! * @return short describtion of what to do */ ! private String secondClickTip() { ! return "Set an axis to rotate around." + ! " Press Escape to cancel rotation."; } ! /** ! * Tip on how to set the third click ! * @return short describtion of what to do ! */ ! private String thirdClickTip() { ! return "Pick a start point of a rotation on the grey disc." + ! " Press Escape to cancel rotation."; } /** ! * Tip on how to set the fourth click ! * @return short describtion of what to do */ ! private String fourthClickTip() { ! return "Pick an end point of a rotation on the grey disc." + ! " Use \"length\" to type a specific number of degrees to rotate" + ! " Press Escape to cancel rotation."; } } --- 369,471 ---- public void prepare() { setLabel("Angle:"); + System.out.println("rotation-prepare " + System.currentTimeMillis()); + if (!Selection.primary().isEmpty()) { + activate(Selection.primary()); + } } ! ! /** ! * ! * @param geometric Geometric */ ! public void activate(Geometric geometric) { ! Collection<Geometric> geometrics = new LinkedList(); ! activate(geometrics); ! system = CoordinateSystem.systemFor(geometric); ! if (system != null) { ! system = system.copy(); } } ! /** ! * ! * @param geometrics Geometrics */ ! public void activate(Collection<Geometric> geometrics) { ! vertices = new LinkedList(Geometric.collect(geometrics)); ! cache(); ! affected = getAffected(geometrics); } /** ! * {@inheritDoc} */ public String initialTip() { ! return "Rotate"; } /** ! * {@inheritDoc} */ ! public void cleanUp() { ! super.cleanUp(); ! if (protract != null) { ! editor.getView().removeGlObjects3D(protract); ! protract = null; ! } ! base = null; ! system = null; ! vertices = null; ! affected = null; } ! class OptionAction extends AbstractAction { ! private int mode; ! ! /** ! * Constructs option action ! * @param iconname String ! */ ! public OptionAction(String iconname, int mode) { ! ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource(iconname); ! ImageIcon im = new ImageIcon(url); ! putValue(Action.SMALL_ICON, im); ! this.mode = mode; ! }; ! ! /** {@inheritDoc} */ ! public void actionPerformed(ActionEvent event) { ! RotationTool.this.mode = mode; ! System.out.println("mode is " + mode); ! } } + /** ! * {@inheritDoc} */ ! public List<JComponent> controls() { ! List<JComponent> controls = super.controls(); ! ButtonGroup group = new ButtonGroup(); ! ! { ! JToggleButton button = new JToggleButton(new OptionAction("oneicon.gif", ONE)); ! button.setMargin(new Insets(1, 1, 1, 1)); ! button.setMaximumSize(button.getMinimumSize()); ! button.setSelected(Editor.isMulti()); ! controls.add(button); ! group.add(button); ! } ! { ! JToggleButton button = new JToggleButton(new OptionAction("twoicon.gif", TWO)); ! button.setMargin(new Insets(1, 1, 1, 1)); ! button.setMaximumSize(button.getMinimumSize()); ! button.setSelected(Editor.isMulti()); ! controls.add(button); ! group.add(button); ! } ! return controls; } } |