001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.vmd.midp.propertyeditors.resource.elements;
043:
044: import org.netbeans.modules.vmd.midp.propertyeditors.api.resource.element.PropertyEditorResourceElement;
045: import java.awt.Font;
046: import java.awt.event.ActionEvent;
047: import java.awt.event.ActionListener;
048: import java.util.Arrays;
049: import java.util.List;
050: import java.util.Map;
051: import javax.swing.JComponent;
052: import org.netbeans.modules.vmd.api.model.DesignComponent;
053: import org.netbeans.modules.vmd.api.model.DesignDocument;
054: import org.netbeans.modules.vmd.api.model.PropertyValue;
055: import org.netbeans.modules.vmd.api.model.TypeID;
056: import org.netbeans.modules.vmd.api.model.common.ActiveDocumentSupport;
057: import org.netbeans.modules.vmd.midp.components.MidpTypes;
058: import org.netbeans.modules.vmd.midp.components.resources.FontCD;
059: import org.netbeans.modules.vmd.midp.screen.display.ScreenSupport;
060:
061: /**
062: *
063: * @author Anton Chechel
064: */
065: public class FontEditorElement extends PropertyEditorResourceElement {
066:
067: private FontStub currentStub;
068: private Font defaultFont;
069:
070: public FontEditorElement() {
071: initComponents();
072: attachListeners();
073:
074: this .defaultFont = sampleLabel.getFont();
075: }
076:
077: public JComponent getJComponent() {
078: return this ;
079: }
080:
081: public TypeID getTypeID() {
082: return FontCD.TYPEID;
083: }
084:
085: public List<String> getPropertyValueNames() {
086: return Arrays.asList(FontCD.PROP_FONT_KIND, FontCD.PROP_FACE,
087: FontCD.PROP_STYLE, FontCD.PROP_SIZE);
088: }
089:
090: private void attachListeners() {
091: ActionListener kindActionListener = new KindActionListener();
092: defaultRadioButton.addActionListener(kindActionListener);
093: staticRadioButton.addActionListener(kindActionListener);
094: inputRadioButton.addActionListener(kindActionListener);
095: customRadioButton.addActionListener(kindActionListener);
096:
097: ActionListener faceActionListener = new FaceActionListener();
098: systemRadioButton.addActionListener(faceActionListener);
099: monospaceRadioButton.addActionListener(faceActionListener);
100: proportionalRadioButton.addActionListener(faceActionListener);
101:
102: ActionListener styleActionListener = new StyleActionListener();
103: plainCheckBox.addActionListener(styleActionListener);
104: boldCheckBox.addActionListener(styleActionListener);
105: italicCheckBox.addActionListener(styleActionListener);
106: underlinedCheckBox.addActionListener(styleActionListener);
107:
108: ActionListener sizeActionListener = new SizeActionListener();
109: smallRadioButton.addActionListener(sizeActionListener);
110: mediumRadioButton.addActionListener(sizeActionListener);
111: largeRadioButton.addActionListener(sizeActionListener);
112: }
113:
114: private void setKindUnselected() {
115: defaultRadioButton.setSelected(false);
116: staticRadioButton.setSelected(false);
117: inputRadioButton.setSelected(false);
118: customRadioButton.setSelected(false);
119: }
120:
121: private void setDefaultFont() {
122: systemRadioButton.setSelected(false);
123: monospaceRadioButton.setSelected(false);
124: proportionalRadioButton.setSelected(false);
125:
126: plainCheckBox.setSelected(false);
127: boldCheckBox.setSelected(false);
128: italicCheckBox.setSelected(false);
129: underlinedCheckBox.setSelected(false);
130:
131: smallRadioButton.setSelected(false);
132: mediumRadioButton.setSelected(false);
133: largeRadioButton.setSelected(false);
134:
135: setSampleFont(true);
136: }
137:
138: private void setFaceSizeStyleEnabled(boolean isEnabled) {
139: faceLabel.setEnabled(isEnabled);
140: systemRadioButton.setEnabled(isEnabled);
141: monospaceRadioButton.setEnabled(isEnabled);
142: proportionalRadioButton.setEnabled(isEnabled);
143:
144: styleLabel.setEnabled(isEnabled);
145: plainCheckBox.setEnabled(isEnabled);
146: boldCheckBox.setEnabled(isEnabled);
147: italicCheckBox.setEnabled(isEnabled);
148: underlinedCheckBox.setEnabled(isEnabled);
149:
150: sizeLabel.setEnabled(isEnabled);
151: smallRadioButton.setEnabled(isEnabled);
152: mediumRadioButton.setEnabled(isEnabled);
153: largeRadioButton.setEnabled(isEnabled);
154: }
155:
156: private void setKindEnabled(boolean isEnabled) {
157: kindLabel.setEnabled(isEnabled);
158: defaultRadioButton.setEnabled(isEnabled);
159: staticRadioButton.setEnabled(isEnabled);
160: inputRadioButton.setEnabled(isEnabled);
161: customRadioButton.setEnabled(isEnabled);
162: }
163:
164: private void setAllEnabled(boolean isEnabled) {
165: setKindEnabled(isEnabled);
166: setFaceSizeStyleEnabled(isEnabled);
167: }
168:
169: private void setKindSelected(int kindCode) {
170: switch (kindCode) {
171: case FontCD.VALUE_KIND_DEFAULT:
172: defaultRadioButton.setSelected(true);
173: break;
174: case FontCD.VALUE_KIND_CUSTOM:
175: customRadioButton.setSelected(true);
176: break;
177: case FontCD.VALUE_KIND_STATIC:
178: staticRadioButton.setSelected(true);
179: break;
180: case FontCD.VALUE_KIND_INPUT:
181: inputRadioButton.setSelected(true);
182: }
183: }
184:
185: private void setFaceSelected(int faceCode) {
186: switch (faceCode) {
187: case FontCD.VALUE_FACE_SYSTEM:
188: systemRadioButton.setSelected(true);
189: break;
190: case FontCD.VALUE_FACE_MONOSPACE:
191: monospaceRadioButton.setSelected(true);
192: break;
193: case FontCD.VALUE_FACE_PROPORTIONAL:
194: proportionalRadioButton.setSelected(true);
195: }
196: }
197:
198: private void setSizeSelected(int sizeCode) {
199: switch (sizeCode) {
200: case FontCD.VALUE_SIZE_SMALL:
201: smallRadioButton.setSelected(true);
202: break;
203: case FontCD.VALUE_SIZE_MEDIUM:
204: mediumRadioButton.setSelected(true);
205: break;
206: case FontCD.VALUE_SIZE_LARGE:
207: largeRadioButton.setSelected(true);
208: }
209: }
210:
211: private void setStyleSelected(int styleCode) {
212: if (styleCode == FontCD.VALUE_STYLE_PLAIN) {
213: plainCheckBox.setSelected(true);
214: } else {
215: boldCheckBox
216: .setSelected((styleCode & FontCD.VALUE_STYLE_BOLD) != 0);
217: italicCheckBox
218: .setSelected((styleCode & FontCD.VALUE_STYLE_ITALIC) != 0);
219: underlinedCheckBox
220: .setSelected((styleCode & FontCD.VALUE_STYLE_UNDERLINED) != 0);
221: }
222: }
223:
224: private void setStateOfButtons() {
225: int kindCode = currentStub.getKind();
226: setKindSelected(kindCode);
227:
228: if (kindCode == FontCD.VALUE_KIND_CUSTOM) {
229: int faceCode = currentStub.getFace();
230: int styleCode = currentStub.getStyle();
231: int sizeCode = currentStub.getSize();
232:
233: setFaceSelected(faceCode);
234: setStyleSelected(styleCode);
235: setSizeSelected(sizeCode);
236: } else {
237: setFaceSizeStyleEnabled(false);
238: }
239: }
240:
241: private void setSampleFont(boolean isDefault) {
242: if (isDefault) {
243: sampleLabel.setFont(defaultFont);
244: return;
245: }
246:
247: DesignDocument document = ActiveDocumentSupport.getDefault()
248: .getActiveDocument();
249: if (document != null) {
250: int kindCode = currentStub.getKind();
251: int faceCode = currentStub.getFace();
252: int styleCode = currentStub.getStyle();
253: int sizeCode = currentStub.getSize();
254: sampleLabel.setFont(ScreenSupport.getFont(document,
255: kindCode, faceCode, styleCode, sizeCode));
256: }
257: }
258:
259: public void setDesignComponentWrapper(
260: final DesignComponentWrapper wrapper) {
261: if (wrapper == null) {
262: // UI stuff
263: setKindUnselected();
264: setDefaultFont();
265: setAllEnabled(false);
266: return;
267: }
268:
269: long componentID = wrapper.getComponentID();
270: final int[] kindCode = new int[] { FontCD.VALUE_KIND_DEFAULT };
271: final int[] faceCode = new int[] { FontCD.VALUE_FACE_SYSTEM };
272: final int[] styleCode = new int[] { FontCD.VALUE_STYLE_PLAIN };
273: final int[] sizeCode = new int[] { FontCD.VALUE_SIZE_MEDIUM };
274:
275: final DesignComponent component = wrapper.getComponent();
276: if (component != null) { // existing component
277: if (!component.getType().equals(getTypeID())) {
278: throw new IllegalArgumentException(
279: "Passed component must have typeID "
280: + getTypeID() + " instead passed "
281: + component.getType()); // NOI18N
282: }
283:
284: componentID = component.getComponentID();
285: component.getDocument().getTransactionManager().readAccess(
286: new Runnable() {
287: public void run() {
288: PropertyValue propertyValue = component
289: .readProperty(FontCD.PROP_FONT_KIND);
290: if (!isPropertyValueAUserCodeType(propertyValue)) {
291: kindCode[0] = MidpTypes
292: .getInteger(propertyValue);
293: }
294: propertyValue = component
295: .readProperty(FontCD.PROP_FACE);
296: if (!isPropertyValueAUserCodeType(propertyValue)) {
297: faceCode[0] = MidpTypes
298: .getInteger(propertyValue);
299: }
300: propertyValue = component
301: .readProperty(FontCD.PROP_STYLE);
302: if (!isPropertyValueAUserCodeType(propertyValue)) {
303: styleCode[0] = MidpTypes
304: .getInteger(propertyValue);
305: }
306: propertyValue = component
307: .readProperty(FontCD.PROP_SIZE);
308: if (!isPropertyValueAUserCodeType(propertyValue)) {
309: sizeCode[0] = MidpTypes
310: .getInteger(propertyValue);
311: }
312: }
313: });
314: }
315:
316: if (wrapper.hasChanges()) {
317: Map<String, PropertyValue> changes = wrapper.getChanges();
318: for (String propertyName : changes.keySet()) {
319: final PropertyValue propertyValue = changes
320: .get(propertyName);
321: if (FontCD.PROP_FONT_KIND.equals(propertyName)) {
322: kindCode[0] = MidpTypes.getInteger(propertyValue);
323: } else if (FontCD.PROP_FACE.equals(propertyName)) {
324: faceCode[0] = MidpTypes.getInteger(propertyValue);
325: } else if (FontCD.PROP_STYLE.equals(propertyName)) {
326: styleCode[0] = MidpTypes.getInteger(propertyValue);
327: } else if (FontCD.PROP_SIZE.equals(propertyName)) {
328: sizeCode[0] = MidpTypes.getInteger(propertyValue);
329: }
330: }
331: }
332:
333: currentStub = new FontStub(componentID, kindCode[0],
334: faceCode[0], styleCode[0], sizeCode[0]);
335:
336: // UI stuff
337: setStateOfButtons();
338: setKindEnabled(true);
339: setFaceSizeStyleEnabled(kindCode[0] == FontCD.VALUE_KIND_CUSTOM);
340: setSampleFont(false);
341: }
342:
343: private static class FontStub {
344: private long componentID;
345: private int kind;
346: private int face;
347: private int style;
348: private int size;
349: private boolean isChanged;
350:
351: public FontStub(long componentID, int kind, int face,
352: int style, int size) {
353: this .componentID = componentID;
354: this .kind = kind;
355: this .face = face;
356: this .style = style;
357: this .size = size;
358: }
359:
360: public long getComponentID() {
361: return componentID;
362: }
363:
364: public boolean isChanged() {
365: return isChanged;
366: }
367:
368: public void setWasChanged(boolean isChanged) {
369: this .isChanged = isChanged;
370: }
371:
372: public int getKind() {
373: return kind;
374: }
375:
376: public void setKind(int kind) {
377: this .kind = kind;
378: }
379:
380: public int getFace() {
381: return face;
382: }
383:
384: public void setFace(int face) {
385: this .face = face;
386: }
387:
388: public int getStyle() {
389: return style;
390: }
391:
392: public void setStyle(int style) {
393: this .style = style;
394: }
395:
396: public int getSize() {
397: return size;
398: }
399:
400: public void setSize(int size) {
401: this .size = size;
402: }
403:
404: @Override
405: public String toString() {
406: StringBuffer str = new StringBuffer();
407: str.append("[componentID="); // NOI18N
408: str.append(componentID);
409: str.append(", kind="); // NOI18N
410: str.append(kind);
411: str.append(", face="); // NOI18N
412: str.append(face);
413: str.append(", style="); // NOI18N
414: str.append(style);
415: str.append(", size="); // NOI18N
416: str.append(size);
417: str.append(']'); // NOI18N
418: return str.toString(); // NOI18N
419: }
420: }
421:
422: private class KindActionListener implements ActionListener {
423: public void actionPerformed(ActionEvent e) {
424: Object src = e.getSource();
425: int code = FontCD.VALUE_KIND_DEFAULT;
426:
427: if (src == customRadioButton) {
428: setFaceSizeStyleEnabled(true);
429: code = FontCD.VALUE_KIND_CUSTOM;
430: } else if (src == defaultRadioButton) {
431: setFaceSizeStyleEnabled(false);
432: code = FontCD.VALUE_KIND_DEFAULT;
433: } else if (src == staticRadioButton) {
434: setFaceSizeStyleEnabled(false);
435: code = FontCD.VALUE_KIND_STATIC;
436: } else if (src == inputRadioButton) {
437: setFaceSizeStyleEnabled(false);
438: code = FontCD.VALUE_KIND_INPUT;
439: }
440:
441: currentStub.setKind(code);
442: setSampleFont(false);
443: fireElementChanged(currentStub.getComponentID(),
444: FontCD.PROP_FONT_KIND, MidpTypes
445: .createIntegerValue(code));
446: }
447: }
448:
449: private class SizeActionListener implements ActionListener {
450: public void actionPerformed(ActionEvent e) {
451: Object src = e.getSource();
452: int code = FontCD.VALUE_SIZE_MEDIUM;
453:
454: if (src == smallRadioButton) {
455: code = FontCD.VALUE_SIZE_SMALL;
456: } else if (src == largeRadioButton) {
457: code = FontCD.VALUE_SIZE_LARGE;
458: }
459:
460: currentStub.setSize(code);
461: setSampleFont(false);
462: fireElementChanged(currentStub.getComponentID(),
463: FontCD.PROP_SIZE, MidpTypes
464: .createIntegerValue(code));
465: }
466: }
467:
468: private class FaceActionListener implements ActionListener {
469: public void actionPerformed(ActionEvent e) {
470: Object src = e.getSource();
471: int code = FontCD.VALUE_FACE_SYSTEM;
472:
473: if (src == monospaceRadioButton) {
474: code = FontCD.VALUE_FACE_MONOSPACE;
475: } else if (src == proportionalRadioButton) {
476: code = FontCD.VALUE_FACE_PROPORTIONAL;
477: }
478:
479: currentStub.setFace(code);
480: setSampleFont(false);
481: fireElementChanged(currentStub.getComponentID(),
482: FontCD.PROP_FACE, MidpTypes
483: .createIntegerValue(code));
484: }
485: }
486:
487: private class StyleActionListener implements ActionListener {
488: public void actionPerformed(ActionEvent e) {
489: Object src = e.getSource();
490: int code = FontCD.VALUE_STYLE_PLAIN;
491: if (src == plainCheckBox) {
492: if (plainCheckBox.isSelected()) {
493: boldCheckBox.setSelected(false);
494: italicCheckBox.setSelected(false);
495: underlinedCheckBox.setSelected(false);
496: }
497: } else {
498: plainCheckBox
499: .setSelected(!(boldCheckBox.isSelected()
500: || italicCheckBox.isSelected() || underlinedCheckBox
501: .isSelected()));
502:
503: if (boldCheckBox.isSelected()) {
504: code |= FontCD.VALUE_STYLE_BOLD;
505: }
506: if (italicCheckBox.isSelected()) {
507: code |= FontCD.VALUE_STYLE_ITALIC;
508: }
509: if (underlinedCheckBox.isSelected()) {
510: code |= FontCD.VALUE_STYLE_UNDERLINED;
511: }
512: }
513:
514: currentStub.setStyle(code);
515: setSampleFont(false);
516: fireElementChanged(currentStub.getComponentID(),
517: FontCD.PROP_STYLE, MidpTypes
518: .createIntegerValue(code));
519: }
520: }
521:
522: /** This method is called from within the constructor to
523: * initialize the form.
524: * WARNING: Do NOT modify this code. The content of this method is
525: * always regenerated by the Form Editor.
526: */
527: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
528: private void initComponents() {
529:
530: kindButtonGroup = new javax.swing.ButtonGroup();
531: faceButtonGroup = new javax.swing.ButtonGroup();
532: sizeButtonGroup = new javax.swing.ButtonGroup();
533: defaultRadioButton = new javax.swing.JRadioButton();
534: staticRadioButton = new javax.swing.JRadioButton();
535: inputRadioButton = new javax.swing.JRadioButton();
536: customRadioButton = new javax.swing.JRadioButton();
537: kindLabel = new javax.swing.JLabel();
538: jPanel2 = new javax.swing.JPanel();
539: jPanel1 = new javax.swing.JPanel();
540: sampleLabel = new javax.swing.JLabel();
541: faceLabel = new javax.swing.JLabel();
542: systemRadioButton = new javax.swing.JRadioButton();
543: monospaceRadioButton = new javax.swing.JRadioButton();
544: proportionalRadioButton = new javax.swing.JRadioButton();
545: sizeLabel = new javax.swing.JLabel();
546: smallRadioButton = new javax.swing.JRadioButton();
547: mediumRadioButton = new javax.swing.JRadioButton();
548: largeRadioButton = new javax.swing.JRadioButton();
549: styleLabel = new javax.swing.JLabel();
550: plainCheckBox = new javax.swing.JCheckBox();
551: boldCheckBox = new javax.swing.JCheckBox();
552: italicCheckBox = new javax.swing.JCheckBox();
553: underlinedCheckBox = new javax.swing.JCheckBox();
554:
555: kindButtonGroup.add(defaultRadioButton);
556: defaultRadioButton.setSelected(true);
557: org.openide.awt.Mnemonics.setLocalizedText(defaultRadioButton,
558: org.openide.util.NbBundle.getMessage(
559: FontEditorElement.class,
560: "FontEditorElement.defaultRadioButton.text")); // NOI18N
561: defaultRadioButton.setBorder(javax.swing.BorderFactory
562: .createEmptyBorder(0, 0, 0, 0));
563: defaultRadioButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
564:
565: kindButtonGroup.add(staticRadioButton);
566: org.openide.awt.Mnemonics.setLocalizedText(staticRadioButton,
567: org.openide.util.NbBundle.getMessage(
568: FontEditorElement.class,
569: "FontEditorElement.staticRadioButton.text")); // NOI18N
570: staticRadioButton.setBorder(javax.swing.BorderFactory
571: .createEmptyBorder(0, 0, 0, 0));
572: staticRadioButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
573:
574: kindButtonGroup.add(inputRadioButton);
575: org.openide.awt.Mnemonics.setLocalizedText(inputRadioButton,
576: org.openide.util.NbBundle.getMessage(
577: FontEditorElement.class,
578: "FontEditorElement.inputRadioButton.text")); // NOI18N
579: inputRadioButton.setBorder(javax.swing.BorderFactory
580: .createEmptyBorder(0, 0, 0, 0));
581: inputRadioButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
582:
583: kindButtonGroup.add(customRadioButton);
584: org.openide.awt.Mnemonics.setLocalizedText(customRadioButton,
585: org.openide.util.NbBundle.getMessage(
586: FontEditorElement.class,
587: "FontEditorElement.customRadioButton.text")); // NOI18N
588: customRadioButton.setBorder(javax.swing.BorderFactory
589: .createEmptyBorder(0, 0, 0, 0));
590: customRadioButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
591:
592: kindLabel.setText(org.openide.util.NbBundle.getMessage(
593: FontEditorElement.class,
594: "FontEditorElement.kindLabel.text")); // NOI18N
595:
596: jPanel2
597: .setBorder(javax.swing.BorderFactory
598: .createTitledBorder(org.openide.util.NbBundle
599: .getMessage(FontEditorElement.class,
600: "FontEditorElement.jPanel2.border.title"))); // NOI18N
601: jPanel2.setLayout(new java.awt.BorderLayout());
602:
603: jPanel1.setLayout(null);
604:
605: sampleLabel.setFont(new java.awt.Font("Dialog", 0, 12));
606: sampleLabel.setText(org.openide.util.NbBundle.getMessage(
607: FontEditorElement.class,
608: "FontEditorElement.sampleLabel.text")); // NOI18N
609: jPanel1.add(sampleLabel);
610: sampleLabel.setBounds(0, 0, 310, 16);
611:
612: jPanel2.add(jPanel1, java.awt.BorderLayout.CENTER);
613:
614: faceLabel.setText(org.openide.util.NbBundle.getMessage(
615: FontEditorElement.class,
616: "FontEditorElement.faceLabel.text")); // NOI18N
617: faceLabel.setEnabled(false);
618:
619: faceButtonGroup.add(systemRadioButton);
620: org.openide.awt.Mnemonics.setLocalizedText(systemRadioButton,
621: org.openide.util.NbBundle.getMessage(
622: FontEditorElement.class,
623: "FontEditorElement.systemRadioButton.text")); // NOI18N
624: systemRadioButton.setBorder(javax.swing.BorderFactory
625: .createEmptyBorder(0, 0, 0, 0));
626: systemRadioButton.setEnabled(false);
627: systemRadioButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
628:
629: faceButtonGroup.add(monospaceRadioButton);
630: org.openide.awt.Mnemonics.setLocalizedText(
631: monospaceRadioButton,
632: org.openide.util.NbBundle.getMessage(
633: FontEditorElement.class,
634: "FontEditorElement.monospaceRadioButton.text")); // NOI18N
635: monospaceRadioButton.setBorder(javax.swing.BorderFactory
636: .createEmptyBorder(0, 0, 0, 0));
637: monospaceRadioButton.setEnabled(false);
638: monospaceRadioButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
639:
640: faceButtonGroup.add(proportionalRadioButton);
641: org.openide.awt.Mnemonics
642: .setLocalizedText(
643: proportionalRadioButton,
644: org.openide.util.NbBundle
645: .getMessage(FontEditorElement.class,
646: "FontEditorElement.proportionalRadioButton.text")); // NOI18N
647: proportionalRadioButton.setBorder(javax.swing.BorderFactory
648: .createEmptyBorder(0, 0, 0, 0));
649: proportionalRadioButton.setEnabled(false);
650: proportionalRadioButton.setMargin(new java.awt.Insets(0, 0, 0,
651: 0));
652:
653: sizeLabel.setText(org.openide.util.NbBundle.getMessage(
654: FontEditorElement.class,
655: "FontEditorElement.sizeLabel.text")); // NOI18N
656: sizeLabel.setEnabled(false);
657:
658: sizeButtonGroup.add(smallRadioButton);
659: org.openide.awt.Mnemonics.setLocalizedText(smallRadioButton,
660: org.openide.util.NbBundle.getMessage(
661: FontEditorElement.class,
662: "FontEditorElement.smallRadioButton.text")); // NOI18N
663: smallRadioButton.setBorder(javax.swing.BorderFactory
664: .createEmptyBorder(0, 0, 0, 0));
665: smallRadioButton.setEnabled(false);
666: smallRadioButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
667:
668: sizeButtonGroup.add(mediumRadioButton);
669: org.openide.awt.Mnemonics.setLocalizedText(mediumRadioButton,
670: org.openide.util.NbBundle.getMessage(
671: FontEditorElement.class,
672: "FontEditorElement.mediumRadioButton.text")); // NOI18N
673: mediumRadioButton.setBorder(javax.swing.BorderFactory
674: .createEmptyBorder(0, 0, 0, 0));
675: mediumRadioButton.setEnabled(false);
676: mediumRadioButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
677:
678: sizeButtonGroup.add(largeRadioButton);
679: org.openide.awt.Mnemonics.setLocalizedText(largeRadioButton,
680: org.openide.util.NbBundle.getMessage(
681: FontEditorElement.class,
682: "FontEditorElement.largeRadioButton.text")); // NOI18N
683: largeRadioButton.setBorder(javax.swing.BorderFactory
684: .createEmptyBorder(0, 0, 0, 0));
685: largeRadioButton.setEnabled(false);
686: largeRadioButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
687:
688: styleLabel.setText(org.openide.util.NbBundle.getMessage(
689: FontEditorElement.class,
690: "FontEditorElement.styleLabel.text")); // NOI18N
691: styleLabel.setEnabled(false);
692:
693: org.openide.awt.Mnemonics.setLocalizedText(plainCheckBox,
694: org.openide.util.NbBundle.getMessage(
695: FontEditorElement.class,
696: "FontEditorElement.plainCheckBox.text")); // NOI18N
697: plainCheckBox.setBorder(javax.swing.BorderFactory
698: .createEmptyBorder(0, 0, 0, 0));
699: plainCheckBox.setEnabled(false);
700: plainCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
701:
702: org.openide.awt.Mnemonics.setLocalizedText(boldCheckBox,
703: org.openide.util.NbBundle.getMessage(
704: FontEditorElement.class,
705: "FontEditorElement.boldCheckBox.text")); // NOI18N
706: boldCheckBox.setBorder(javax.swing.BorderFactory
707: .createEmptyBorder(0, 0, 0, 0));
708: boldCheckBox.setEnabled(false);
709: boldCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
710:
711: org.openide.awt.Mnemonics.setLocalizedText(italicCheckBox,
712: org.openide.util.NbBundle.getMessage(
713: FontEditorElement.class,
714: "FontEditorElement.italicCheckBox.text")); // NOI18N
715: italicCheckBox.setBorder(javax.swing.BorderFactory
716: .createEmptyBorder(0, 0, 0, 0));
717: italicCheckBox.setEnabled(false);
718: italicCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
719:
720: org.openide.awt.Mnemonics.setLocalizedText(underlinedCheckBox,
721: org.openide.util.NbBundle.getMessage(
722: FontEditorElement.class,
723: "FontEditorElement.underlinedCheckBox.text")); // NOI18N
724: underlinedCheckBox.setBorder(javax.swing.BorderFactory
725: .createEmptyBorder(0, 0, 0, 0));
726: underlinedCheckBox.setEnabled(false);
727: underlinedCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
728:
729: org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
730: this );
731: this .setLayout(layout);
732: layout
733: .setHorizontalGroup(layout
734: .createParallelGroup(
735: org.jdesktop.layout.GroupLayout.LEADING)
736: .add(
737: layout
738: .createSequentialGroup()
739: .add(
740: layout
741: .createParallelGroup(
742: org.jdesktop.layout.GroupLayout.LEADING)
743: .add(
744: defaultRadioButton)
745: .add(
746: staticRadioButton)
747: .add(
748: inputRadioButton)
749: .add(
750: customRadioButton)
751: .add(kindLabel))
752: .addPreferredGap(
753: org.jdesktop.layout.LayoutStyle.RELATED)
754: .add(
755: layout
756: .createParallelGroup(
757: org.jdesktop.layout.GroupLayout.LEADING)
758: .add(faceLabel)
759: .add(
760: systemRadioButton)
761: .add(
762: monospaceRadioButton)
763: .add(
764: proportionalRadioButton))
765: .addPreferredGap(
766: org.jdesktop.layout.LayoutStyle.RELATED)
767: .add(
768: layout
769: .createParallelGroup(
770: org.jdesktop.layout.GroupLayout.LEADING)
771: .add(
772: largeRadioButton)
773: .add(sizeLabel)
774: .add(
775: mediumRadioButton)
776: .add(
777: smallRadioButton))
778: .addPreferredGap(
779: org.jdesktop.layout.LayoutStyle.RELATED)
780: .add(
781: layout
782: .createParallelGroup(
783: org.jdesktop.layout.GroupLayout.LEADING)
784: .add(styleLabel)
785: .add(
786: underlinedCheckBox)
787: .add(
788: boldCheckBox)
789: .add(
790: plainCheckBox)
791: .add(
792: italicCheckBox))
793: .addContainerGap())
794: .add(
795: org.jdesktop.layout.GroupLayout.TRAILING,
796: jPanel2,
797: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
798: 328, Short.MAX_VALUE));
799:
800: layout.linkSize(new java.awt.Component[] { boldCheckBox,
801: customRadioButton, defaultRadioButton, faceLabel,
802: inputRadioButton, italicCheckBox, kindLabel,
803: largeRadioButton, mediumRadioButton,
804: monospaceRadioButton, plainCheckBox,
805: proportionalRadioButton, sizeLabel, smallRadioButton,
806: staticRadioButton, styleLabel, systemRadioButton,
807: underlinedCheckBox },
808: org.jdesktop.layout.GroupLayout.HORIZONTAL);
809:
810: layout
811: .setVerticalGroup(layout
812: .createParallelGroup(
813: org.jdesktop.layout.GroupLayout.LEADING)
814: .add(
815: layout
816: .createSequentialGroup()
817: .add(
818: layout
819: .createParallelGroup(
820: org.jdesktop.layout.GroupLayout.TRAILING)
821: .add(
822: layout
823: .createSequentialGroup()
824: .add(
825: kindLabel)
826: .addPreferredGap(
827: org.jdesktop.layout.LayoutStyle.RELATED)
828: .add(
829: defaultRadioButton)
830: .addPreferredGap(
831: org.jdesktop.layout.LayoutStyle.RELATED)
832: .add(
833: staticRadioButton)
834: .addPreferredGap(
835: org.jdesktop.layout.LayoutStyle.RELATED)
836: .add(
837: inputRadioButton)
838: .addPreferredGap(
839: org.jdesktop.layout.LayoutStyle.RELATED)
840: .add(
841: customRadioButton))
842: .add(
843: layout
844: .createParallelGroup(
845: org.jdesktop.layout.GroupLayout.LEADING)
846: .add(
847: layout
848: .createSequentialGroup()
849: .add(
850: faceLabel)
851: .addPreferredGap(
852: org.jdesktop.layout.LayoutStyle.RELATED)
853: .add(
854: systemRadioButton)
855: .addPreferredGap(
856: org.jdesktop.layout.LayoutStyle.RELATED)
857: .add(
858: monospaceRadioButton)
859: .addPreferredGap(
860: org.jdesktop.layout.LayoutStyle.RELATED)
861: .add(
862: proportionalRadioButton))
863: .add(
864: layout
865: .createSequentialGroup()
866: .add(
867: layout
868: .createParallelGroup(
869: org.jdesktop.layout.GroupLayout.BASELINE)
870: .add(
871: sizeLabel)
872: .add(
873: styleLabel))
874: .addPreferredGap(
875: org.jdesktop.layout.LayoutStyle.RELATED)
876: .add(
877: smallRadioButton)
878: .addPreferredGap(
879: org.jdesktop.layout.LayoutStyle.RELATED)
880: .add(
881: mediumRadioButton)
882: .addPreferredGap(
883: org.jdesktop.layout.LayoutStyle.RELATED)
884: .add(
885: largeRadioButton))
886: .add(
887: layout
888: .createSequentialGroup()
889: .add(
890: layout
891: .createParallelGroup(
892: org.jdesktop.layout.GroupLayout.LEADING)
893: .add(
894: layout
895: .createSequentialGroup()
896: .add(
897: 20,
898: 20,
899: 20)
900: .add(
901: plainCheckBox)
902: .addPreferredGap(
903: org.jdesktop.layout.LayoutStyle.RELATED)
904: .add(
905: boldCheckBox))
906: .add(
907: layout
908: .createSequentialGroup()
909: .add(
910: 62,
911: 62,
912: 62)
913: .add(
914: italicCheckBox)))
915: .addPreferredGap(
916: org.jdesktop.layout.LayoutStyle.RELATED)
917: .add(
918: underlinedCheckBox))))
919: .addPreferredGap(
920: org.jdesktop.layout.LayoutStyle.RELATED)
921: .add(
922: jPanel2,
923: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
924: 55, Short.MAX_VALUE)));
925: }// </editor-fold>//GEN-END:initComponents
926:
927: // Variables declaration - do not modify//GEN-BEGIN:variables
928: private javax.swing.JCheckBox boldCheckBox;
929: private javax.swing.JRadioButton customRadioButton;
930: private javax.swing.JRadioButton defaultRadioButton;
931: private javax.swing.ButtonGroup faceButtonGroup;
932: private javax.swing.JLabel faceLabel;
933: private javax.swing.JRadioButton inputRadioButton;
934: private javax.swing.JCheckBox italicCheckBox;
935: private javax.swing.JPanel jPanel1;
936: private javax.swing.JPanel jPanel2;
937: private javax.swing.ButtonGroup kindButtonGroup;
938: private javax.swing.JLabel kindLabel;
939: private javax.swing.JRadioButton largeRadioButton;
940: private javax.swing.JRadioButton mediumRadioButton;
941: private javax.swing.JRadioButton monospaceRadioButton;
942: private javax.swing.JCheckBox plainCheckBox;
943: private javax.swing.JRadioButton proportionalRadioButton;
944: private javax.swing.JLabel sampleLabel;
945: private javax.swing.ButtonGroup sizeButtonGroup;
946: private javax.swing.JLabel sizeLabel;
947: private javax.swing.JRadioButton smallRadioButton;
948: private javax.swing.JRadioButton staticRadioButton;
949: private javax.swing.JLabel styleLabel;
950: private javax.swing.JRadioButton systemRadioButton;
951: private javax.swing.JCheckBox underlinedCheckBox;
952: // End of variables declaration//GEN-END:variables
953: }
|