📄 texttab.java
字号:
/** * Method called when the "OK" panel is hit. * Updates any changed fields in the Text tab. */ public void term() { boolean editCellsChanged = false; boolean textCellsChanged = false; String currentFontName = (String)textDefaultFont.getSelectedItem(); if (!currentFontName.equalsIgnoreCase(User.getDefaultFont())) { User.setDefaultFont(currentFontName); editCellsChanged = true; } currentFontName = (String)textCellFont.getSelectedItem(); if (!currentFontName.equalsIgnoreCase(User.getDefaultTextCellFont())) { User.setDefaultTextCellFont(currentFontName); textCellsChanged = true; } int currInt = TextUtils.atoi(textCellSize.getText()); if (currInt != User.getDefaultTextCellSize()) { User.setDefaultTextCellSize(currInt); textCellsChanged = true; } String externalEditor = textExternalEditor.getText(); if (externalEditor.startsWith(EXTERNALEDITOR_HEADER)) externalEditor = externalEditor.substring(EXTERNALEDITOR_HEADER.length()); if (externalEditor.equals(EXTERNALEDITOR_NOTSET)) externalEditor = ""; if (!externalEditor.equals(User.getDefaultTextExternalEditor())) User.setDefaultTextExternalEditor(externalEditor); if (!currentTextNodeDescriptor.equals(initialTextNodeDescriptor)) TextDescriptor.setNodeTextDescriptor(currentTextNodeDescriptor); if (!currentTextArcDescriptor.equals(initialTextArcDescriptor)) TextDescriptor.setArcTextDescriptor(currentTextArcDescriptor); if (!currentTextExportDescriptor.equals(initialTextExportDescriptor)) TextDescriptor.setExportTextDescriptor(currentTextExportDescriptor); if (!currentTextAnnotationDescriptor.equals(initialTextAnnotationDescriptor)) TextDescriptor.setAnnotationTextDescriptor(currentTextAnnotationDescriptor); if (!currentTextInstanceDescriptor.equals(initialTextInstanceDescriptor)) TextDescriptor.setInstanceTextDescriptor(currentTextInstanceDescriptor); if (!currentTextCellDescriptor.equals(initialTextCellDescriptor)) TextDescriptor.setCellTextDescriptor(currentTextCellDescriptor); double currentGlobalScale = TextUtils.atof(textGlobalScale.getText()) / 100; if (currentGlobalScale != User.getGlobalTextScale()) { User.setGlobalTextScale(currentGlobalScale); editCellsChanged = true; } currentGlobalScale = TextUtils.atof(textWindowScale.getText()) / 100; EditWindow wnd = EditWindow.getCurrent(); if (wnd != null && currentGlobalScale != wnd.getGlobalTextScale()) { wnd.setGlobalTextScale(currentGlobalScale); editCellsChanged = true; } if (textCellsChanged || editCellsChanged) { // redraw appropriate cells for(Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext(); ) { WindowFrame wf = it.next(); if (textCellsChanged && wf.getContent() instanceof TextWindow) { TextWindow tw = (TextWindow)wf.getContent(); tw.updateFontInformation(); } if (editCellsChanged && wf.getContent() instanceof EditWindow) { EditWindow w = (EditWindow)wf.getContent(); w.fullRepaint(); } } } } /** * Method called when the factory reset is requested. */ public void reset() { TextDescriptor.factoryResetNodeTextDescriptor(); TextDescriptor.factoryResetArcTextDescriptor(); TextDescriptor.factoryResetExportTextDescriptor(); TextDescriptor.factoryResetAnnotationTextDescriptor(); TextDescriptor.factoryResetInstanceTextDescriptor(); TextDescriptor.factoryResetCellTextDescriptor(); if (!User.getFactoryDefaultTextCellFont().equals(User.getDefaultTextCellFont())) User.setDefaultTextCellFont(User.getFactoryDefaultTextCellFont()); if (User.getFactoryDefaultTextCellSize() != User.getDefaultTextCellSize()) User.setDefaultTextCellSize(User.getFactoryDefaultTextCellSize()); if (!User.getFactoryDefaultTextExternalEditor().equals(User.getDefaultTextExternalEditor())) User.setDefaultTextExternalEditor(User.getFactoryDefaultTextExternalEditor()); if (!User.getFactoryDefaultFont().equals(User.getDefaultFont())) User.setDefaultFont(User.getFactoryDefaultFont()); if (User.getFactoryGlobalTextScale() != User.getGlobalTextScale()) User.setGlobalTextScale(User.getFactoryGlobalTextScale()); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; textSizeGroup = new javax.swing.ButtonGroup(); textTypeGroup = new javax.swing.ButtonGroup(); text = new javax.swing.JPanel(); top = new javax.swing.JPanel(); jLabel41 = new javax.swing.JLabel(); textNodes = new javax.swing.JRadioButton(); textArcs = new javax.swing.JRadioButton(); textPorts = new javax.swing.JRadioButton(); textAnnotation = new javax.swing.JRadioButton(); textInstances = new javax.swing.JRadioButton(); textCellText = new javax.swing.JRadioButton(); jLabel42 = new javax.swing.JLabel(); textPointSize = new javax.swing.JTextField(); textUnitSize = new javax.swing.JTextField(); jLabel43 = new javax.swing.JLabel(); textFace = new javax.swing.JComboBox(); textItalic = new javax.swing.JCheckBox(); textBold = new javax.swing.JCheckBox(); textUnderline = new javax.swing.JCheckBox(); textPoints = new javax.swing.JRadioButton(); textUnits = new javax.swing.JRadioButton(); jSeparator3 = new javax.swing.JSeparator(); jLabel6 = new javax.swing.JLabel(); textAnchor = new javax.swing.JComboBox(); textNewVisibleInsideCell = new javax.swing.JCheckBox(); globals = new javax.swing.JPanel(); jLabel44 = new javax.swing.JLabel(); textDefaultFont = new javax.swing.JComboBox(); jLabel1 = new javax.swing.JLabel(); textGlobalScale = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); textWindowScale = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); textCells = new javax.swing.JPanel(); jLabel7 = new javax.swing.JLabel(); textCellFont = new javax.swing.JComboBox(); jLabel3 = new javax.swing.JLabel(); textCellSize = new javax.swing.JTextField(); textExternalEditor = new javax.swing.JLabel(); textSetExternalEditor = new javax.swing.JButton(); textClearExternalEditor = new javax.swing.JButton(); getContentPane().setLayout(new java.awt.GridBagLayout()); setTitle("Edit Options"); setName(""); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); text.setLayout(new java.awt.GridBagLayout()); top.setLayout(new java.awt.GridBagLayout()); top.setBorder(javax.swing.BorderFactory.createTitledBorder("Default Style for New Text")); jLabel41.setText("Which type of new text:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 3; gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 4); top.add(jLabel41, gridBagConstraints); textTypeGroup.add(textNodes); textNodes.setText("Node text"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 2, 4); top.add(textNodes, gridBagConstraints); textTypeGroup.add(textArcs); textArcs.setText("Arc text"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 2, 4); top.add(textArcs, gridBagConstraints); textTypeGroup.add(textPorts); textPorts.setText("Exports/Ports"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 2, 4); top.add(textPorts, gridBagConstraints); textTypeGroup.add(textAnnotation); textAnnotation.setText("Annotation text"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(2, 4, 4, 4); top.add(textAnnotation, gridBagConstraints); textTypeGroup.add(textInstances); textInstances.setText("Instance names"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(2, 4, 4, 4); top.add(textInstances, gridBagConstraints); textTypeGroup.add(textCellText); textCellText.setText("Cell text"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(2, 4, 4, 4); top.add(textCellText, gridBagConstraints); jLabel42.setText("Size:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.gridheight = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); top.add(jLabel42, gridBagConstraints); textPointSize.setColumns(8); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 1, 4); top.add(textPointSize, gridBagConstraints); textUnitSize.setColumns(8); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(1, 4, 4, 4); top.add(textUnitSize, gridBagConstraints); jLabel43.setText("Font:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); top.add(jLabel43, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 7; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); top.add(textFace, gridBagConstraints); textItalic.setText("Italic"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 8; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 2, 4); top.add(textItalic, gridBagConstraints); textBold.setText("Bold"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 8; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 2, 4); top.add(textBold, gridBagConstraints); textUnderline.setText("Underline"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 8; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 2, 4); top.add(textUnderline, gridBagConstraints);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -