Source Code Cross Referenced for FontStyleEditor.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » propertyeditors » css » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » visualweb.api.designer » org.netbeans.modules.visualweb.propertyeditors.css 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003:         *
0004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005:         *
0006:         * The contents of this file are subject to the terms of either the GNU
0007:         * General Public License Version 2 only ("GPL") or the Common
0008:         * Development and Distribution License("CDDL") (collectively, the
0009:         * "License"). You may not use this file except in compliance with the
0010:         * License. You can obtain a copy of the License at
0011:         * http://www.netbeans.org/cddl-gplv2.html
0012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013:         * specific language governing permissions and limitations under the
0014:         * License.  When distributing the software, include this License Header
0015:         * Notice in each file and include the License file at
0016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
0017:         * particular file as subject to the "Classpath" exception as provided
0018:         * by Sun in the GPL Version 2 section of the License file that
0019:         * accompanied this code. If applicable, add the following below the
0020:         * License Header, with the fields enclosed by brackets [] replaced by
0021:         * your own identifying information:
0022:         * "Portions Copyrighted [year] [name of copyright owner]"
0023:         *
0024:         * Contributor(s):
0025:         *
0026:         * The Original Software is NetBeans. The Initial Developer of the Original
0027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
0028:         * Microsystems, Inc. All Rights Reserved.
0029:         *
0030:         * If you wish your version of this file to be governed by only the CDDL
0031:         * or only the GPL Version 2, indicate your decision by adding
0032:         * "[Contributor] elects to include this software in this distribution
0033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034:         * single choice of license, a recipient has the option to distribute
0035:         * your version of this file under either the CDDL, the GPL Version 2 or
0036:         * to extend the choice of license to its licensees as provided above.
0037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
0038:         * Version 2 license, then the option applies only if the new code is
0039:         * made subject to such option by the copyright holder.
0040:         */
0041:        package org.netbeans.modules.visualweb.propertyeditors.css;
0042:
0043:        import org.netbeans.modules.visualweb.propertyeditors.css.model.CssStyleData;
0044:        import org.netbeans.modules.visualweb.propertyeditors.css.model.FontModel;
0045:        import org.netbeans.modules.visualweb.propertyeditors.css.model.PropertyData;
0046:        import org.netbeans.modules.visualweb.propertyeditors.css.model.PropertyWithUnitData;
0047:        import org.netbeans.modules.visualweb.propertyeditors.css.model.TextDecorationData;
0048:        import org.netbeans.modules.visualweb.propertyeditors.css.model.Utils;
0049:        import java.awt.BorderLayout;
0050:        import java.awt.Dimension;
0051:        import java.awt.FontMetrics;
0052:        import java.beans.PropertyChangeEvent;
0053:        import java.beans.PropertyChangeListener;
0054:        import java.util.StringTokenizer;
0055:        import javax.swing.DefaultComboBoxModel;
0056:        import javax.swing.DefaultListModel;
0057:        import javax.swing.SwingUtilities;
0058:        import org.openide.util.NbBundle;
0059:
0060:        /**
0061:         * Font Style editor.
0062:         * @author  Winston Prakash
0063:         *          Jeff Hoffman (HIE design)
0064:         */
0065:        public class FontStyleEditor extends StyleEditor implements 
0066:                PropertyChangeListener {
0067:
0068:            CssStyleData cssStyleData = null;
0069:
0070:            ColorSelectionField colorField = new ColorSelectionField();
0071:            TextDecorationData textDecorationData = new TextDecorationData();
0072:
0073:            FontModel fontModel = new FontModel();
0074:            DefaultListModel fontFamilies = fontModel.getFontFamilySetList();
0075:
0076:            /** Creates new form FontStyleEditor */
0077:            public FontStyleEditor(CssStyleData styleData) {
0078:                cssStyleData = styleData;
0079:                setName("fontStyleEditor"); //NOI18N
0080:                setDisplayName(NbBundle.getMessage(StyleBuilderDialog.class,
0081:                        "FONT_EDITOR_DISPNAME"));
0082:                initComponents();
0083:                colorSelectionPanel.add(colorField, BorderLayout.CENTER);
0084:                colorField.addCssPropertyChangeListener(this );
0085:                initialize();
0086:            }
0087:
0088:            private void initialize() {
0089:                // Set the font family to the GUI
0090:                fontFamilies = fontModel.getFontFamilySetList();
0091:                fontFaceList.setModel(fontFamilies);
0092:                String fontFamily = cssStyleData
0093:                        .getProperty(CssStyleData.FONT_FAMILY);
0094:                if (fontFamily != null) {
0095:                    // This is a work around. Since batik parser puts the quotes around
0096:                    // fonts with out spaces, remove the quotes from those fonts before
0097:                    // adding it to the list, else the font set will appear doubly - one
0098:                    // with quotes and one with out quotes.
0099:                    String fontSet = "";
0100:                    StringTokenizer st = new StringTokenizer(fontFamily.trim(),
0101:                            ",");
0102:                    while (st.hasMoreTokens()) {
0103:                        String fontName = st.nextToken();
0104:                        if (new StringTokenizer(fontName.trim()).countTokens() == 1) {
0105:                            fontName = fontName.replaceAll("'", "");
0106:                        }
0107:                        fontSet += fontName;
0108:                        if (st.hasMoreTokens())
0109:                            fontSet += ",";
0110:                    }
0111:
0112:                    if (!fontFamilies.contains(fontSet)) {
0113:                        fontFamilies.add(1, fontSet);
0114:                    }
0115:                    fontFaceList
0116:                            .setSelectedIndex(fontFamilies.indexOf(fontSet));
0117:                } else {
0118:                    fontFaceList.setSelectedIndex(0);
0119:                }
0120:
0121:                // Set the font size to the GUI
0122:                DefaultListModel fontSizes = fontModel.getFontSizeList();
0123:                fontSizeList.setModel(fontSizes);
0124:
0125:                DefaultComboBoxModel fontSizeUnits = fontModel
0126:                        .getFontSizeUnitList();
0127:                fontSizeUnitCombo.setModel(fontSizeUnits);
0128:
0129:                String fontSizeStr = cssStyleData
0130:                        .getProperty(CssStyleData.FONT_SIZE);
0131:                if (fontSizeStr != null) {
0132:                    // First check if absolute relative (large largere etc) font-size identifiers
0133:                    if (fontSizes.contains(fontSizeStr)) {
0134:                        fontSizeList.setSelectedIndex(fontSizes
0135:                                .indexOf(fontSizeStr));
0136:                    } else {
0137:                        // Try splitiing in to numerical font size and unit
0138:                        FontModel.FontSize fontSize = fontModel
0139:                                .getFontSize(fontSizeStr);
0140:                        if (fontSize.getValue() != null) {
0141:                            if (fontSizes.contains(fontSize.getValue())) {
0142:                                fontSizeList.setSelectedIndex(fontSizes
0143:                                        .indexOf(fontSize.getValue()));
0144:                            } else {
0145:                                fontSizeField.setText(fontSize.getValue());
0146:                            }
0147:                        } else {
0148:                            fontSizeList.setSelectedIndex(0);
0149:                        }
0150:                        if (fontSizeUnits.getIndexOf(fontSize.getUnit()) != -1) {
0151:                            fontSizeUnitCombo.setSelectedIndex(fontSizeUnits
0152:                                    .getIndexOf(fontSize.getUnit()));
0153:                        }
0154:                    }
0155:                } else {
0156:                    fontSizeList.setSelectedIndex(0);
0157:                }
0158:
0159:                // Set the font Style to the GUI
0160:                DefaultComboBoxModel fontStyles = fontModel.getFontStyleList();
0161:                fontStyleComboBox.setModel(fontStyles);
0162:                String fontStyle = cssStyleData
0163:                        .getProperty(CssStyleData.FONT_STYLE);
0164:                if (fontStyle != null) {
0165:                    if (fontStyles.getIndexOf(fontStyle) != -1) {
0166:                        fontStyleComboBox.setSelectedIndex(fontStyles
0167:                                .getIndexOf(fontStyle));
0168:                    }
0169:                } else {
0170:                    fontStyleComboBox.setSelectedIndex(0);
0171:                }
0172:
0173:                // Set the font Weight to the GUI
0174:                DefaultComboBoxModel fontWeights = fontModel
0175:                        .getFontWeightList();
0176:                fontWeightComboBox.setModel(fontWeights);
0177:                String fontWeight = cssStyleData
0178:                        .getProperty(CssStyleData.FONT_WEIGHT);
0179:                if (fontWeight != null) {
0180:                    if (fontWeights.getIndexOf(fontWeight) != -1) {
0181:                        fontWeightComboBox.setSelectedIndex(fontWeights
0182:                                .getIndexOf(fontWeight));
0183:                    }
0184:                } else {
0185:                    fontWeightComboBox.setSelectedIndex(0);
0186:                }
0187:
0188:                // Set the font Variant to the GUI
0189:                DefaultComboBoxModel fontVariants = fontModel
0190:                        .getFontVariantList();
0191:                fontVariantComboBox.setModel(fontVariants);
0192:                String fontVariant = cssStyleData
0193:                        .getProperty(CssStyleData.FONT_VARIANT);
0194:                if (fontVariant != null) {
0195:                    if (fontVariants.getIndexOf(fontVariant) != -1) {
0196:                        fontVariantComboBox.setSelectedIndex(fontVariants
0197:                                .getIndexOf(fontVariant));
0198:                    }
0199:                } else {
0200:                    fontVariantComboBox.setSelectedIndex(0);
0201:                }
0202:
0203:                // Set the Text Decoration the GUI
0204:                String textDecoration = cssStyleData
0205:                        .getProperty(CssStyleData.TEXT_DECORATION);
0206:                if (textDecoration != null) {
0207:                    textDecorationData.setDecoration(textDecoration);
0208:                    underlineCheckbox.setSelected(textDecorationData
0209:                            .underlineEnabled());
0210:                    overlineCheckbox.setSelected(textDecorationData
0211:                            .overlineEnabled());
0212:                    strikethroughCheckbox.setSelected(textDecorationData
0213:                            .lineThroughEnabled());
0214:                }
0215:
0216:                // Set the Bckground Color the GUI
0217:                String textColor = cssStyleData.getProperty(CssStyleData.COLOR);
0218:                if (textColor != null) {
0219:                    colorField.setColorString(textColor);
0220:                }
0221:
0222:                FontMetrics fontMetrics = fontSizeField
0223:                        .getFontMetrics(fontSizeField.getFont());
0224:                int width = fontMetrics.stringWidth((String) fontSizes.get(0)) + 10;
0225:                int height = (fontMetrics.getHeight() + 10) > 25 ? fontMetrics
0226:                        .getHeight() + 10 : 25;
0227:                fontSizeField.setPreferredSize(new Dimension(width, height));
0228:            }
0229:
0230:            /** Listens to the color property change in the color chooser filed */
0231:            public void propertyChange(PropertyChangeEvent evt) {
0232:                setFontColor();
0233:            }
0234:
0235:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
0236:            private void initComponents() {
0237:                java.awt.GridBagConstraints gridBagConstraints;
0238:
0239:                mainPanel = new javax.swing.JPanel();
0240:                fontFamilyPanel = new javax.swing.JPanel();
0241:                fontLabel = new javax.swing.JLabel();
0242:                fontFaceScroll = new javax.swing.JScrollPane();
0243:                fontFaceList = new javax.swing.JList();
0244:                fontChosenField = new javax.swing.JTextField();
0245:                fontFamilyButton = new javax.swing.JButton();
0246:                fontSizePanel = new javax.swing.JPanel();
0247:                sizeLabel = new javax.swing.JLabel();
0248:                fontSizeField = new javax.swing.JTextField();
0249:                fontSizeUnitCombo = new javax.swing.JComboBox();
0250:                fontSizeScroll = new javax.swing.JScrollPane();
0251:                fontSizeList = new javax.swing.JList();
0252:                styleMainPanel = new javax.swing.JPanel();
0253:                stylePanel = new javax.swing.JPanel();
0254:                styleLabel = new javax.swing.JLabel();
0255:                fontStyleComboBox = new javax.swing.JComboBox();
0256:                weightLabel = new javax.swing.JLabel();
0257:                fontWeightComboBox = new javax.swing.JComboBox();
0258:                variantLabel = new javax.swing.JLabel();
0259:                fontVariantComboBox = new javax.swing.JComboBox();
0260:                colorLabel = new javax.swing.JLabel();
0261:                colorSelectionPanel = new javax.swing.JPanel();
0262:                decorationPanel = new javax.swing.JPanel();
0263:                decorationLabel = new javax.swing.JLabel();
0264:                underlineCheckbox = new javax.swing.JCheckBox();
0265:                strikethroughCheckbox = new javax.swing.JCheckBox();
0266:                overlineCheckbox = new javax.swing.JCheckBox();
0267:                noDecorationCheckbox = new javax.swing.JCheckBox();
0268:                errorPanel = new javax.swing.JPanel();
0269:                errorLabel = new javax.swing.JLabel();
0270:
0271:                setLayout(new java.awt.BorderLayout());
0272:
0273:                mainPanel.setLayout(new java.awt.BorderLayout());
0274:
0275:                fontFamilyPanel.setBorder(javax.swing.BorderFactory
0276:                        .createEmptyBorder(5, 5, 5, 5));
0277:                fontFamilyPanel.setLayout(new java.awt.GridBagLayout());
0278:
0279:                fontLabel
0280:                        .setDisplayedMnemonic(java.util.ResourceBundle
0281:                                .getBundle(
0282:                                        "org/netbeans/modules/visualweb/propertyeditors/css/Bundle")
0283:                                .getString("FONT_FAMILY_MNEMONIC").charAt(0));
0284:                fontLabel.setLabelFor(fontChosenField);
0285:                java.util.ResourceBundle bundle = java.util.ResourceBundle
0286:                        .getBundle("org/netbeans/modules/visualweb/propertyeditors/css/Bundle"); // NOI18N
0287:                fontLabel.setText(bundle.getString("Font_Family")); // NOI18N
0288:                fontLabel.setMinimumSize(new java.awt.Dimension(200, 15));
0289:                gridBagConstraints = new java.awt.GridBagConstraints();
0290:                gridBagConstraints.gridx = 0;
0291:                gridBagConstraints.gridy = 0;
0292:                gridBagConstraints.gridwidth = 2;
0293:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0294:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0295:                gridBagConstraints.weightx = 1.0;
0296:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
0297:                fontFamilyPanel.add(fontLabel, gridBagConstraints);
0298:
0299:                fontFaceList
0300:                        .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
0301:                fontFaceList
0302:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
0303:                            public void valueChanged(
0304:                                    javax.swing.event.ListSelectionEvent evt) {
0305:                                fontFaceListValueChanged(evt);
0306:                            }
0307:                        });
0308:                fontFaceScroll.setViewportView(fontFaceList);
0309:                fontFaceList.getAccessibleContext().setAccessibleName(
0310:                        bundle.getString("FontFamilyList")); // NOI18N
0311:                fontFaceList
0312:                        .getAccessibleContext()
0313:                        .setAccessibleDescription(
0314:                                bundle
0315:                                        .getString("FontFamilyListAccessibleDescription")); // NOI18N
0316:
0317:                gridBagConstraints = new java.awt.GridBagConstraints();
0318:                gridBagConstraints.gridx = 0;
0319:                gridBagConstraints.gridy = 2;
0320:                gridBagConstraints.gridwidth = 2;
0321:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0322:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
0323:                gridBagConstraints.weightx = 1.0;
0324:                gridBagConstraints.weighty = 1.0;
0325:                fontFamilyPanel.add(fontFaceScroll, gridBagConstraints);
0326:
0327:                fontChosenField.setEditable(false);
0328:                fontChosenField.setMargin(new java.awt.Insets(1, 2, 2, 4));
0329:                gridBagConstraints = new java.awt.GridBagConstraints();
0330:                gridBagConstraints.gridx = 0;
0331:                gridBagConstraints.gridy = 1;
0332:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0333:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0334:                gridBagConstraints.weightx = 1.0;
0335:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
0336:                fontFamilyPanel.add(fontChosenField, gridBagConstraints);
0337:                fontChosenField.getAccessibleContext().setAccessibleName(
0338:                        bundle.getString("chosenFontsAccessibleName")); // NOI18N
0339:                fontChosenField
0340:                        .getAccessibleContext()
0341:                        .setAccessibleDescription(
0342:                                bundle
0343:                                        .getString("ChosenFontAccessibleDescription")); // NOI18N
0344:
0345:                fontFamilyButton
0346:                        .setMnemonic(java.util.ResourceBundle
0347:                                .getBundle(
0348:                                        "org/netbeans/modules/visualweb/propertyeditors/css/Bundle")
0349:                                .getString("EDIT_FONT_FAMILY_MNEMONIC").charAt(
0350:                                        0));
0351:                fontFamilyButton.setText(bundle.getString("EDIT")); // NOI18N
0352:                fontFamilyButton.setMargin(new java.awt.Insets(4, 4, 4, 4));
0353:                fontFamilyButton
0354:                        .addActionListener(new java.awt.event.ActionListener() {
0355:                            public void actionPerformed(
0356:                                    java.awt.event.ActionEvent evt) {
0357:                                fontFamilyButtonActionPerformed(evt);
0358:                            }
0359:                        });
0360:                gridBagConstraints = new java.awt.GridBagConstraints();
0361:                gridBagConstraints.gridx = 1;
0362:                gridBagConstraints.gridy = 1;
0363:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0364:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0365:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0);
0366:                fontFamilyPanel.add(fontFamilyButton, gridBagConstraints);
0367:                fontFamilyButton
0368:                        .getAccessibleContext()
0369:                        .setAccessibleDescription(
0370:                                bundle
0371:                                        .getString("EditChosenFontsAccessibleDescription")); // NOI18N
0372:
0373:                mainPanel.add(fontFamilyPanel, java.awt.BorderLayout.CENTER);
0374:
0375:                fontSizePanel.setBorder(javax.swing.BorderFactory
0376:                        .createEmptyBorder(5, 5, 5, 5));
0377:                fontSizePanel.setLayout(new java.awt.GridBagLayout());
0378:
0379:                sizeLabel
0380:                        .setDisplayedMnemonic(java.util.ResourceBundle
0381:                                .getBundle(
0382:                                        "org/netbeans/modules/visualweb/propertyeditors/css/Bundle")
0383:                                .getString("FONT_SIZE_MNEMONIC").charAt(0));
0384:                sizeLabel.setLabelFor(fontSizeField);
0385:                sizeLabel.setText(bundle.getString("FONT_SIZE")); // NOI18N
0386:                gridBagConstraints = new java.awt.GridBagConstraints();
0387:                gridBagConstraints.gridx = 0;
0388:                gridBagConstraints.gridy = 0;
0389:                gridBagConstraints.gridwidth = 2;
0390:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0391:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0392:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
0393:                fontSizePanel.add(sizeLabel, gridBagConstraints);
0394:
0395:                fontSizeField
0396:                        .setHorizontalAlignment(javax.swing.JTextField.LEFT);
0397:                fontSizeField
0398:                        .addActionListener(new java.awt.event.ActionListener() {
0399:                            public void actionPerformed(
0400:                                    java.awt.event.ActionEvent evt) {
0401:                                fontSizeFieldActionPerformed(evt);
0402:                            }
0403:                        });
0404:                fontSizeField
0405:                        .addFocusListener(new java.awt.event.FocusAdapter() {
0406:                            public void focusLost(java.awt.event.FocusEvent evt) {
0407:                                fontSizeFieldFocusLost(evt);
0408:                            }
0409:                        });
0410:                fontSizeField.addKeyListener(new java.awt.event.KeyAdapter() {
0411:                    public void keyTyped(java.awt.event.KeyEvent evt) {
0412:                        fontSizeFieldKeyTyped(evt);
0413:                    }
0414:                });
0415:                gridBagConstraints = new java.awt.GridBagConstraints();
0416:                gridBagConstraints.gridx = 0;
0417:                gridBagConstraints.gridy = 1;
0418:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0419:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0420:                gridBagConstraints.weightx = 0.5;
0421:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
0422:                fontSizePanel.add(fontSizeField, gridBagConstraints);
0423:                fontSizeField.getAccessibleContext().setAccessibleName(
0424:                        bundle.getString("ChosenFontSizeAccessibleName")); // NOI18N
0425:                fontSizeField
0426:                        .getAccessibleContext()
0427:                        .setAccessibleDescription(
0428:                                bundle
0429:                                        .getString("ChosenFontSizeAccessibleDescription")); // NOI18N
0430:
0431:                fontSizeUnitCombo
0432:                        .addItemListener(new java.awt.event.ItemListener() {
0433:                            public void itemStateChanged(
0434:                                    java.awt.event.ItemEvent evt) {
0435:                                fontSizeUnitComboItemStateChanged(evt);
0436:                            }
0437:                        });
0438:                gridBagConstraints = new java.awt.GridBagConstraints();
0439:                gridBagConstraints.gridx = 1;
0440:                gridBagConstraints.gridy = 1;
0441:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
0442:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0);
0443:                fontSizePanel.add(fontSizeUnitCombo, gridBagConstraints);
0444:                fontSizeUnitCombo.getAccessibleContext().setAccessibleName(
0445:                        bundle.getString("FontSizeUnitListAccessibleName")); // NOI18N
0446:                fontSizeUnitCombo
0447:                        .getAccessibleContext()
0448:                        .setAccessibleDescription(
0449:                                bundle
0450:                                        .getString("FontSizeUnitListAccessibleDescription")); // NOI18N
0451:
0452:                fontSizeList
0453:                        .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
0454:                fontSizeList
0455:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
0456:                            public void valueChanged(
0457:                                    javax.swing.event.ListSelectionEvent evt) {
0458:                                fontSizeListValueChanged(evt);
0459:                            }
0460:                        });
0461:                fontSizeScroll.setViewportView(fontSizeList);
0462:                fontSizeList.getAccessibleContext().setAccessibleName(
0463:                        bundle.getString("FontSizeListAccessibleName")); // NOI18N
0464:                fontSizeList.getAccessibleContext().setAccessibleDescription(
0465:                        bundle.getString("FontSizeListAccessibleDesription")); // NOI18N
0466:
0467:                gridBagConstraints = new java.awt.GridBagConstraints();
0468:                gridBagConstraints.gridx = 0;
0469:                gridBagConstraints.gridy = 2;
0470:                gridBagConstraints.gridwidth = 2;
0471:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0472:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
0473:                gridBagConstraints.weighty = 1.0;
0474:                fontSizePanel.add(fontSizeScroll, gridBagConstraints);
0475:
0476:                mainPanel.add(fontSizePanel, java.awt.BorderLayout.EAST);
0477:
0478:                styleMainPanel.setLayout(new java.awt.BorderLayout(20, 0));
0479:
0480:                stylePanel.setBorder(javax.swing.BorderFactory
0481:                        .createEmptyBorder(5, 5, 5, 5));
0482:                stylePanel.setLayout(new java.awt.GridBagLayout());
0483:
0484:                styleLabel
0485:                        .setDisplayedMnemonic(java.util.ResourceBundle
0486:                                .getBundle(
0487:                                        "org/netbeans/modules/visualweb/propertyeditors/css/Bundle")
0488:                                .getString("FONT_STYLE_MNEMONIC").charAt(0));
0489:                styleLabel.setLabelFor(fontStyleComboBox);
0490:                styleLabel.setText(bundle.getString("FONT_STYLE")); // NOI18N
0491:                gridBagConstraints = new java.awt.GridBagConstraints();
0492:                gridBagConstraints.gridx = 0;
0493:                gridBagConstraints.gridy = 0;
0494:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0495:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0496:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
0497:                stylePanel.add(styleLabel, gridBagConstraints);
0498:
0499:                fontStyleComboBox
0500:                        .setMinimumSize(new java.awt.Dimension(150, 20));
0501:                fontStyleComboBox.setPreferredSize(new java.awt.Dimension(150,
0502:                        20));
0503:                fontStyleComboBox
0504:                        .addItemListener(new java.awt.event.ItemListener() {
0505:                            public void itemStateChanged(
0506:                                    java.awt.event.ItemEvent evt) {
0507:                                fontStyleComboBoxItemStateChanged(evt);
0508:                            }
0509:                        });
0510:                fontStyleComboBox
0511:                        .addActionListener(new java.awt.event.ActionListener() {
0512:                            public void actionPerformed(
0513:                                    java.awt.event.ActionEvent evt) {
0514:                                fontStyleComboBoxActionPerformed(evt);
0515:                            }
0516:                        });
0517:                fontStyleComboBox
0518:                        .addFocusListener(new java.awt.event.FocusAdapter() {
0519:                            public void focusLost(java.awt.event.FocusEvent evt) {
0520:                                fontStyleComboBoxFocusLost(evt);
0521:                            }
0522:                        });
0523:                gridBagConstraints = new java.awt.GridBagConstraints();
0524:                gridBagConstraints.gridx = 1;
0525:                gridBagConstraints.gridy = 0;
0526:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0527:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0528:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0);
0529:                stylePanel.add(fontStyleComboBox, gridBagConstraints);
0530:                fontStyleComboBox
0531:                        .getAccessibleContext()
0532:                        .setAccessibleDescription(
0533:                                bundle
0534:                                        .getString("FontStyleSelectionAccessibleDescription")); // NOI18N
0535:
0536:                weightLabel
0537:                        .setDisplayedMnemonic(java.util.ResourceBundle
0538:                                .getBundle(
0539:                                        "org/netbeans/modules/visualweb/propertyeditors/css/Bundle")
0540:                                .getString("FONT_WEIGHT_MNEMONIC").charAt(0));
0541:                weightLabel.setLabelFor(fontWeightComboBox);
0542:                weightLabel.setText(bundle.getString("FONT_WEIGHT")); // NOI18N
0543:                gridBagConstraints = new java.awt.GridBagConstraints();
0544:                gridBagConstraints.gridx = 0;
0545:                gridBagConstraints.gridy = 1;
0546:                gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
0547:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0548:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
0549:                stylePanel.add(weightLabel, gridBagConstraints);
0550:
0551:                fontWeightComboBox.setMinimumSize(new java.awt.Dimension(150,
0552:                        20));
0553:                fontWeightComboBox
0554:                        .addActionListener(new java.awt.event.ActionListener() {
0555:                            public void actionPerformed(
0556:                                    java.awt.event.ActionEvent evt) {
0557:                                fontWeightComboBoxActionPerformed(evt);
0558:                            }
0559:                        });
0560:                fontWeightComboBox
0561:                        .addFocusListener(new java.awt.event.FocusAdapter() {
0562:                            public void focusLost(java.awt.event.FocusEvent evt) {
0563:                                fontWeightComboBoxFocusLost(evt);
0564:                            }
0565:                        });
0566:                fontWeightComboBox
0567:                        .addItemListener(new java.awt.event.ItemListener() {
0568:                            public void itemStateChanged(
0569:                                    java.awt.event.ItemEvent evt) {
0570:                                fontWeightComboBoxItemStateChanged(evt);
0571:                            }
0572:                        });
0573:                gridBagConstraints = new java.awt.GridBagConstraints();
0574:                gridBagConstraints.gridx = 1;
0575:                gridBagConstraints.gridy = 1;
0576:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0577:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0578:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0);
0579:                stylePanel.add(fontWeightComboBox, gridBagConstraints);
0580:                fontWeightComboBox
0581:                        .getAccessibleContext()
0582:                        .setAccessibleDescription(
0583:                                bundle
0584:                                        .getString("FontWeightSelectionAccessibleDescription")); // NOI18N
0585:
0586:                variantLabel
0587:                        .setDisplayedMnemonic(java.util.ResourceBundle
0588:                                .getBundle(
0589:                                        "org/netbeans/modules/visualweb/propertyeditors/css/Bundle")
0590:                                .getString("FONT_VARIANT_MNEMONIC").charAt(0));
0591:                variantLabel.setLabelFor(fontVariantComboBox);
0592:                variantLabel.setText(bundle.getString("FONT_VARIANT")); // NOI18N
0593:                gridBagConstraints = new java.awt.GridBagConstraints();
0594:                gridBagConstraints.gridx = 0;
0595:                gridBagConstraints.gridy = 2;
0596:                gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
0597:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0598:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
0599:                stylePanel.add(variantLabel, gridBagConstraints);
0600:                variantLabel
0601:                        .getAccessibleContext()
0602:                        .setAccessibleDescription(
0603:                                bundle
0604:                                        .getString("FontVariantSelectionAccessibleDescription")); // NOI18N
0605:
0606:                fontVariantComboBox.setMinimumSize(new java.awt.Dimension(150,
0607:                        20));
0608:                fontVariantComboBox
0609:                        .addItemListener(new java.awt.event.ItemListener() {
0610:                            public void itemStateChanged(
0611:                                    java.awt.event.ItemEvent evt) {
0612:                                fontVariantComboBoxItemStateChanged(evt);
0613:                            }
0614:                        });
0615:                fontVariantComboBox
0616:                        .addActionListener(new java.awt.event.ActionListener() {
0617:                            public void actionPerformed(
0618:                                    java.awt.event.ActionEvent evt) {
0619:                                fontVariantComboBoxActionPerformed(evt);
0620:                            }
0621:                        });
0622:                fontVariantComboBox
0623:                        .addFocusListener(new java.awt.event.FocusAdapter() {
0624:                            public void focusGained(
0625:                                    java.awt.event.FocusEvent evt) {
0626:                                fontVariantComboBoxFocusGained(evt);
0627:                            }
0628:
0629:                            public void focusLost(java.awt.event.FocusEvent evt) {
0630:                                fontVariantComboBoxFocusLost(evt);
0631:                            }
0632:                        });
0633:                gridBagConstraints = new java.awt.GridBagConstraints();
0634:                gridBagConstraints.gridx = 1;
0635:                gridBagConstraints.gridy = 2;
0636:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0637:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0638:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0);
0639:                stylePanel.add(fontVariantComboBox, gridBagConstraints);
0640:                fontVariantComboBox
0641:                        .getAccessibleContext()
0642:                        .setAccessibleDescription(
0643:                                bundle
0644:                                        .getString("FontVariantSelectionAccessibleDescription")); // NOI18N
0645:
0646:                colorLabel
0647:                        .setDisplayedMnemonic(java.util.ResourceBundle
0648:                                .getBundle(
0649:                                        "org/netbeans/modules/visualweb/propertyeditors/css/Bundle")
0650:                                .getString("FONT_COLOR_MNEMONICS").charAt(0));
0651:                colorLabel.setLabelFor(colorSelectionPanel);
0652:                colorLabel.setText(bundle.getString("FONT_COLOR")); // NOI18N
0653:                gridBagConstraints = new java.awt.GridBagConstraints();
0654:                gridBagConstraints.gridx = 0;
0655:                gridBagConstraints.gridy = 3;
0656:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0657:                stylePanel.add(colorLabel, gridBagConstraints);
0658:
0659:                colorSelectionPanel.setLayout(new java.awt.BorderLayout());
0660:                gridBagConstraints = new java.awt.GridBagConstraints();
0661:                gridBagConstraints.gridx = 1;
0662:                gridBagConstraints.gridy = 3;
0663:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0664:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
0665:                stylePanel.add(colorSelectionPanel, gridBagConstraints);
0666:
0667:                styleMainPanel.add(stylePanel, java.awt.BorderLayout.WEST);
0668:
0669:                decorationPanel.setBorder(javax.swing.BorderFactory
0670:                        .createEmptyBorder(5, 5, 5, 5));
0671:                decorationPanel.setLayout(new java.awt.GridBagLayout());
0672:
0673:                decorationLabel.setText(bundle.getString("FONT_DECORATION")); // NOI18N
0674:                gridBagConstraints = new java.awt.GridBagConstraints();
0675:                gridBagConstraints.gridx = 0;
0676:                gridBagConstraints.gridy = 0;
0677:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0678:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
0679:                decorationPanel.add(decorationLabel, gridBagConstraints);
0680:
0681:                underlineCheckbox
0682:                        .setMnemonic(java.util.ResourceBundle
0683:                                .getBundle(
0684:                                        "org/netbeans/modules/visualweb/propertyeditors/css/Bundle")
0685:                                .getString("FONT_DECORATION_UNDERLINE_MNEMONIC")
0686:                                .charAt(0));
0687:                underlineCheckbox.setText(bundle.getString("FONT_UNDERLINE")); // NOI18N
0688:                underlineCheckbox.setMargin(new java.awt.Insets(0, 2, 0, 2));
0689:                underlineCheckbox
0690:                        .addItemListener(new java.awt.event.ItemListener() {
0691:                            public void itemStateChanged(
0692:                                    java.awt.event.ItemEvent evt) {
0693:                                underlineCheckboxItemStateChanged(evt);
0694:                            }
0695:                        });
0696:                gridBagConstraints = new java.awt.GridBagConstraints();
0697:                gridBagConstraints.gridx = 1;
0698:                gridBagConstraints.gridy = 0;
0699:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0700:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0701:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0);
0702:                decorationPanel.add(underlineCheckbox, gridBagConstraints);
0703:                underlineCheckbox
0704:                        .getAccessibleContext()
0705:                        .setAccessibleDescription(
0706:                                bundle
0707:                                        .getString("FontUnderlineAccessibleDescription")); // NOI18N
0708:
0709:                strikethroughCheckbox
0710:                        .setMnemonic(java.util.ResourceBundle
0711:                                .getBundle(
0712:                                        "org/netbeans/modules/visualweb/propertyeditors/css/Bundle")
0713:                                .getString(
0714:                                        "FONT_DECORATION_STRIKETHROUGH_MNEMONIC")
0715:                                .charAt(0));
0716:                strikethroughCheckbox.setText(bundle
0717:                        .getString("FONT_STRIKETHROUGH")); // NOI18N
0718:                strikethroughCheckbox
0719:                        .setMargin(new java.awt.Insets(0, 2, 0, 2));
0720:                strikethroughCheckbox
0721:                        .addItemListener(new java.awt.event.ItemListener() {
0722:                            public void itemStateChanged(
0723:                                    java.awt.event.ItemEvent evt) {
0724:                                strikethroughCheckboxItemStateChanged(evt);
0725:                            }
0726:                        });
0727:                gridBagConstraints = new java.awt.GridBagConstraints();
0728:                gridBagConstraints.gridx = 1;
0729:                gridBagConstraints.gridy = 2;
0730:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0731:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0732:                gridBagConstraints.weightx = 1.0;
0733:                gridBagConstraints.weighty = 1.0;
0734:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0);
0735:                decorationPanel.add(strikethroughCheckbox, gridBagConstraints);
0736:                strikethroughCheckbox
0737:                        .getAccessibleContext()
0738:                        .setAccessibleDescription(
0739:                                bundle
0740:                                        .getString("FontStrikeThroughAccessibleDescription")); // NOI18N
0741:
0742:                overlineCheckbox
0743:                        .setMnemonic(java.util.ResourceBundle
0744:                                .getBundle(
0745:                                        "org/netbeans/modules/visualweb/propertyeditors/css/Bundle")
0746:                                .getString("FONT_DECORATION_OVERLINE_MNEMONIC")
0747:                                .charAt(0));
0748:                overlineCheckbox.setText(bundle.getString("FONT_OVERLINE")); // NOI18N
0749:                overlineCheckbox.setMargin(new java.awt.Insets(0, 2, 0, 2));
0750:                overlineCheckbox
0751:                        .addItemListener(new java.awt.event.ItemListener() {
0752:                            public void itemStateChanged(
0753:                                    java.awt.event.ItemEvent evt) {
0754:                                overlineCheckboxItemStateChanged(evt);
0755:                            }
0756:                        });
0757:                gridBagConstraints = new java.awt.GridBagConstraints();
0758:                gridBagConstraints.gridx = 1;
0759:                gridBagConstraints.gridy = 1;
0760:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0761:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0762:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0);
0763:                decorationPanel.add(overlineCheckbox, gridBagConstraints);
0764:                overlineCheckbox
0765:                        .getAccessibleContext()
0766:                        .setAccessibleDescription(
0767:                                bundle
0768:                                        .getString("FontOverlineAccessibleDescription")); // NOI18N
0769:
0770:                noDecorationCheckbox
0771:                        .setMnemonic(java.util.ResourceBundle
0772:                                .getBundle(
0773:                                        "org/netbeans/modules/visualweb/propertyeditors/css/Bundle")
0774:                                .getString("FONT_DECORATION_NONE_MNEMONIC")
0775:                                .charAt(0));
0776:                noDecorationCheckbox.setText(bundle.getString("NO_DECORATION")); // NOI18N
0777:                noDecorationCheckbox
0778:                        .addItemListener(new java.awt.event.ItemListener() {
0779:                            public void itemStateChanged(
0780:                                    java.awt.event.ItemEvent evt) {
0781:                                noDecorationCheckboxItemStateChanged(evt);
0782:                            }
0783:                        });
0784:                gridBagConstraints = new java.awt.GridBagConstraints();
0785:                gridBagConstraints.gridx = 1;
0786:                gridBagConstraints.gridy = 3;
0787:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0788:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
0789:                decorationPanel.add(noDecorationCheckbox, gridBagConstraints);
0790:                noDecorationCheckbox
0791:                        .getAccessibleContext()
0792:                        .setAccessibleDescription(
0793:                                bundle
0794:                                        .getString("FontNoDecorationAccessibleDescription")); // NOI18N
0795:
0796:                styleMainPanel.add(decorationPanel,
0797:                        java.awt.BorderLayout.CENTER);
0798:
0799:                mainPanel.add(styleMainPanel, java.awt.BorderLayout.SOUTH);
0800:
0801:                add(mainPanel, java.awt.BorderLayout.NORTH);
0802:
0803:                errorPanel.setBorder(javax.swing.BorderFactory
0804:                        .createEmptyBorder(1, 10, 1, 1));
0805:                errorPanel.setLayout(new java.awt.BorderLayout());
0806:
0807:                errorLabel.setForeground(new java.awt.Color(0, 0, 153));
0808:                errorLabel.setMinimumSize(new java.awt.Dimension(200, 20));
0809:                errorLabel.setPreferredSize(new java.awt.Dimension(200, 20));
0810:                errorPanel.add(errorLabel, java.awt.BorderLayout.CENTER);
0811:
0812:                add(errorPanel, java.awt.BorderLayout.CENTER);
0813:            }// </editor-fold>//GEN-END:initComponents
0814:
0815:            private void noDecorationCheckboxItemStateChanged(
0816:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_noDecorationCheckboxItemStateChanged
0817:                textDecorationData
0818:                        .enableNoDecoration((evt.getStateChange() == evt.SELECTED));
0819:                if (evt.getStateChange() == evt.SELECTED) {
0820:                    strikethroughCheckbox.setSelected(false);
0821:                    overlineCheckbox.setSelected(false);
0822:                    underlineCheckbox.setSelected(false);
0823:                    strikethroughCheckbox.setEnabled(false);
0824:                    overlineCheckbox.setEnabled(false);
0825:                    underlineCheckbox.setEnabled(false);
0826:                } else {
0827:                    strikethroughCheckbox.setEnabled(true);
0828:                    overlineCheckbox.setEnabled(true);
0829:                    underlineCheckbox.setEnabled(true);
0830:                }
0831:                setTextDecoration();
0832:            }//GEN-LAST:event_noDecorationCheckboxItemStateChanged
0833:
0834:            private void fontVariantComboBoxFocusGained(
0835:                    java.awt.event.FocusEvent evt) {//GEN-FIRST:event_fontVariantComboBoxFocusGained
0836:                errorLabel.setText(CssStyleData.PREVIEW_NOT_SUPPORTED);
0837:            }//GEN-LAST:event_fontVariantComboBoxFocusGained
0838:
0839:            private void strikethroughCheckboxItemStateChanged(
0840:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_strikethroughCheckboxItemStateChanged
0841:                textDecorationData
0842:                        .enableLineThrough((evt.getStateChange() == evt.SELECTED));
0843:                setTextDecoration();
0844:            }//GEN-LAST:event_strikethroughCheckboxItemStateChanged
0845:
0846:            private void overlineCheckboxItemStateChanged(
0847:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_overlineCheckboxItemStateChanged
0848:                textDecorationData
0849:                        .enableOverline((evt.getStateChange() == evt.SELECTED));
0850:                setTextDecoration();
0851:            }//GEN-LAST:event_overlineCheckboxItemStateChanged
0852:
0853:            private void underlineCheckboxItemStateChanged(
0854:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_underlineCheckboxItemStateChanged
0855:                textDecorationData
0856:                        .enableUnderline((evt.getStateChange() == evt.SELECTED));
0857:                setTextDecoration();
0858:            }//GEN-LAST:event_underlineCheckboxItemStateChanged
0859:
0860:            private void fontVariantComboBoxItemStateChanged(
0861:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_fontVariantComboBoxItemStateChanged
0862:                if (evt.getStateChange() != evt.DESELECTED) {
0863:                    setFontVariant();
0864:                }
0865:            }//GEN-LAST:event_fontVariantComboBoxItemStateChanged
0866:
0867:            private void fontVariantComboBoxFocusLost(
0868:                    java.awt.event.FocusEvent evt) {//GEN-FIRST:event_fontVariantComboBoxFocusLost
0869:                errorLabel.setText("");
0870:                setFontVariant();
0871:            }//GEN-LAST:event_fontVariantComboBoxFocusLost
0872:
0873:            private void fontVariantComboBoxActionPerformed(
0874:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fontVariantComboBoxActionPerformed
0875:                setFontVariant();
0876:            }//GEN-LAST:event_fontVariantComboBoxActionPerformed
0877:
0878:            private void fontWeightComboBoxItemStateChanged(
0879:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_fontWeightComboBoxItemStateChanged
0880:                if (evt.getStateChange() != evt.DESELECTED) {
0881:                    setFontWeight();
0882:                }
0883:            }//GEN-LAST:event_fontWeightComboBoxItemStateChanged
0884:
0885:            private void fontWeightComboBoxActionPerformed(
0886:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fontWeightComboBoxActionPerformed
0887:                setFontWeight();
0888:            }//GEN-LAST:event_fontWeightComboBoxActionPerformed
0889:
0890:            private void fontWeightComboBoxFocusLost(
0891:                    java.awt.event.FocusEvent evt) {//GEN-FIRST:event_fontWeightComboBoxFocusLost
0892:                setFontWeight();
0893:            }//GEN-LAST:event_fontWeightComboBoxFocusLost
0894:
0895:            private void fontStyleComboBoxActionPerformed(
0896:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fontStyleComboBoxActionPerformed
0897:                setFontStyle();
0898:            }//GEN-LAST:event_fontStyleComboBoxActionPerformed
0899:
0900:            private void fontStyleComboBoxFocusLost(
0901:                    java.awt.event.FocusEvent evt) {//GEN-FIRST:event_fontStyleComboBoxFocusLost
0902:                setFontStyle();
0903:            }//GEN-LAST:event_fontStyleComboBoxFocusLost
0904:
0905:            private void fontStyleComboBoxItemStateChanged(
0906:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_fontStyleComboBoxItemStateChanged
0907:                if (evt.getStateChange() != evt.DESELECTED) {
0908:                    setFontStyle();
0909:                }
0910:            }//GEN-LAST:event_fontStyleComboBoxItemStateChanged
0911:
0912:            private void fontSizeUnitComboItemStateChanged(
0913:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_fontSizeUnitComboItemStateChanged
0914:                if (evt.getStateChange() != evt.DESELECTED) {
0915:                    setFontSize();
0916:                }
0917:            }//GEN-LAST:event_fontSizeUnitComboItemStateChanged
0918:
0919:            private void fontSizeFieldActionPerformed(
0920:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fontSizeFieldActionPerformed
0921:                setFontSize();
0922:            }//GEN-LAST:event_fontSizeFieldActionPerformed
0923:
0924:            private void fontSizeFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_fontSizeFieldFocusLost
0925:                setFontSize();
0926:            }//GEN-LAST:event_fontSizeFieldFocusLost
0927:
0928:            private void fontSizeFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_fontSizeFieldKeyTyped
0929:                SwingUtilities.invokeLater(new Runnable() {
0930:                    public void run() {
0931:                        enableFontSizeUnitCombo(Utils.isInteger(fontSizeField
0932:                                .getText()));
0933:                    }
0934:                });
0935:            }//GEN-LAST:event_fontSizeFieldKeyTyped
0936:
0937:            private void fontSizeListValueChanged(
0938:                    javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_fontSizeListValueChanged
0939:                if (evt.getValueIsAdjusting())
0940:                    return;
0941:                String selectedFontSize = (String) fontSizeList
0942:                        .getSelectedValue();
0943:                fontSizeField.setText(selectedFontSize);
0944:                enableFontSizeUnitCombo(Utils.isInteger(selectedFontSize));
0945:                setFontSize();
0946:            }//GEN-LAST:event_fontSizeListValueChanged
0947:
0948:            private void enableFontSizeUnitCombo(final boolean enable) {
0949:                SwingUtilities.invokeLater(new Runnable() {
0950:                    public void run() {
0951:                        fontSizeUnitCombo.setEnabled(enable);
0952:                    }
0953:                });
0954:            }
0955:
0956:            private void fontFaceListValueChanged(
0957:                    javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_fontFaceListValueChanged
0958:                if (evt.getValueIsAdjusting())
0959:                    return;
0960:                fontChosenField.setText(fontFaceList.getSelectedValue()
0961:                        .toString());
0962:                setFontFamily();
0963:            }//GEN-LAST:event_fontFaceListValueChanged
0964:
0965:            private void fontFamilyButtonActionPerformed(
0966:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fontFamilyButtonActionPerformed
0967:                FontFamilyEditorDialog fontFamilyEditor = new FontFamilyEditorDialog(
0968:                        fontFamilies, fontFaceList.getSelectedIndex());
0969:                fontFamilyEditor.showDialog();
0970:                fontFaceList.setSelectedIndex(fontFamilyEditor
0971:                        .getSelectedIndex());
0972:                fontChosenField.setText(fontFaceList.getSelectedValue()
0973:                        .toString());
0974:                setFontFamily();
0975:            }//GEN-LAST:event_fontFamilyButtonActionPerformed
0976:
0977:            private void setFontFamily() {
0978:                PropertyData fontFamilyData = new PropertyData();
0979:                fontFamilyData.setValue(fontChosenField.getText());
0980:                cssStyleData.modifyProperty(CssStyleData.FONT_FAMILY,
0981:                        fontFamilyData.toString());
0982:            }
0983:
0984:            private void setFontSize() {
0985:                //XXX Do we need to put some constraints?
0986:                PropertyWithUnitData fontSizeData = new PropertyWithUnitData();
0987:                fontSizeData.setUnit(fontSizeUnitCombo.getSelectedItem()
0988:                        .toString());
0989:                fontSizeData.setValue(fontSizeField.getText());
0990:                cssStyleData.modifyProperty(CssStyleData.FONT_SIZE,
0991:                        fontSizeData.toString());
0992:            }
0993:
0994:            private void setFontStyle() {
0995:                PropertyData fontStyleData = new PropertyData();
0996:                fontStyleData.setValue(fontStyleComboBox.getSelectedItem()
0997:                        .toString());
0998:                cssStyleData.modifyProperty(CssStyleData.FONT_STYLE,
0999:                        fontStyleData.toString());
1000:            }
1001:
1002:            private void setFontWeight() {
1003:                PropertyData fontWeightData = new PropertyData();
1004:                fontWeightData.setValue(fontWeightComboBox.getSelectedItem()
1005:                        .toString());
1006:                cssStyleData.modifyProperty(CssStyleData.FONT_WEIGHT,
1007:                        fontWeightData.toString());
1008:            }
1009:
1010:            private void setFontVariant() {
1011:                PropertyData fontVariantData = new PropertyData();
1012:                fontVariantData.setValue(fontVariantComboBox.getSelectedItem()
1013:                        .toString());
1014:                cssStyleData.modifyProperty(CssStyleData.FONT_VARIANT,
1015:                        fontVariantData.toString());
1016:            }
1017:
1018:            private void setFontColor() {
1019:                PropertyData fontColorData = new PropertyData();
1020:                fontColorData.setValue(colorField.getColorString());
1021:                cssStyleData.modifyProperty(CssStyleData.COLOR, fontColorData
1022:                        .toString());
1023:            }
1024:
1025:            private void setTextDecoration() {
1026:                cssStyleData.modifyProperty(CssStyleData.TEXT_DECORATION,
1027:                        textDecorationData.toString());
1028:            }
1029:
1030:            // Variables declaration - do not modify//GEN-BEGIN:variables
1031:            private javax.swing.JLabel colorLabel;
1032:            private javax.swing.JPanel colorSelectionPanel;
1033:            private javax.swing.JLabel decorationLabel;
1034:            private javax.swing.JPanel decorationPanel;
1035:            private javax.swing.JLabel errorLabel;
1036:            private javax.swing.JPanel errorPanel;
1037:            private javax.swing.JTextField fontChosenField;
1038:            private javax.swing.JList fontFaceList;
1039:            private javax.swing.JScrollPane fontFaceScroll;
1040:            private javax.swing.JButton fontFamilyButton;
1041:            private javax.swing.JPanel fontFamilyPanel;
1042:            private javax.swing.JLabel fontLabel;
1043:            private javax.swing.JTextField fontSizeField;
1044:            private javax.swing.JList fontSizeList;
1045:            private javax.swing.JPanel fontSizePanel;
1046:            private javax.swing.JScrollPane fontSizeScroll;
1047:            private javax.swing.JComboBox fontSizeUnitCombo;
1048:            private javax.swing.JComboBox fontStyleComboBox;
1049:            private javax.swing.JComboBox fontVariantComboBox;
1050:            private javax.swing.JComboBox fontWeightComboBox;
1051:            private javax.swing.JPanel mainPanel;
1052:            private javax.swing.JCheckBox noDecorationCheckbox;
1053:            private javax.swing.JCheckBox overlineCheckbox;
1054:            private javax.swing.JLabel sizeLabel;
1055:            private javax.swing.JCheckBox strikethroughCheckbox;
1056:            private javax.swing.JLabel styleLabel;
1057:            private javax.swing.JPanel styleMainPanel;
1058:            private javax.swing.JPanel stylePanel;
1059:            private javax.swing.JCheckBox underlineCheckbox;
1060:            private javax.swing.JLabel variantLabel;
1061:            private javax.swing.JLabel weightLabel;
1062:            // End of variables declaration//GEN-END:variables
1063:
1064:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.