List of usage examples for javax.swing JTextPane JTextPane
public JTextPane()
JTextPane
. From source file:com.awesomecoding.minetestlauncher.Main.java
private void initialize() { fileGetter = new FileGetter(userhome + "\\minetest\\temp\\"); latest = fileGetter.getContents("http://socialmelder.com/minetest/latest.txt", true); currentVersion = latest.split("\n")[0]; changelog = fileGetter.getContents("http://socialmelder.com/minetest/changelog.html", false); try {/* w w w . j ava2 s . c o m*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } frmMinetestLauncherV = new JFrame(); frmMinetestLauncherV.setResizable(false); frmMinetestLauncherV.setIconImage(Toolkit.getDefaultToolkit() .getImage(Main.class.getResource("/com/awesomecoding/minetestlauncher/icon.png"))); frmMinetestLauncherV.setTitle("Minetest Launcher (Version 0.1)"); frmMinetestLauncherV.setBounds(100, 100, 720, 480); frmMinetestLauncherV.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); SpringLayout springLayout = new SpringLayout(); frmMinetestLauncherV.getContentPane().setLayout(springLayout); final JProgressBar progressBar = new JProgressBar(); springLayout.putConstraint(SpringLayout.WEST, progressBar, 10, SpringLayout.WEST, frmMinetestLauncherV.getContentPane()); springLayout.putConstraint(SpringLayout.SOUTH, progressBar, -10, SpringLayout.SOUTH, frmMinetestLauncherV.getContentPane()); springLayout.putConstraint(SpringLayout.EAST, progressBar, -130, SpringLayout.EAST, frmMinetestLauncherV.getContentPane()); frmMinetestLauncherV.getContentPane().add(progressBar); final JButton btnDownloadPlay = new JButton("Play!"); springLayout.putConstraint(SpringLayout.WEST, btnDownloadPlay, 6, SpringLayout.EAST, progressBar); springLayout.putConstraint(SpringLayout.SOUTH, btnDownloadPlay, 0, SpringLayout.SOUTH, progressBar); springLayout.putConstraint(SpringLayout.EAST, btnDownloadPlay, -10, SpringLayout.EAST, frmMinetestLauncherV.getContentPane()); frmMinetestLauncherV.getContentPane().add(btnDownloadPlay); final JLabel label = new JLabel("Ready to play!"); springLayout.putConstraint(SpringLayout.WEST, label, 10, SpringLayout.WEST, frmMinetestLauncherV.getContentPane()); springLayout.putConstraint(SpringLayout.NORTH, btnDownloadPlay, 0, SpringLayout.NORTH, label); springLayout.putConstraint(SpringLayout.SOUTH, label, -37, SpringLayout.SOUTH, frmMinetestLauncherV.getContentPane()); springLayout.putConstraint(SpringLayout.NORTH, progressBar, 6, SpringLayout.SOUTH, label); frmMinetestLauncherV.getContentPane().add(label); JTextPane txtpnNewFeatures = new JTextPane(); txtpnNewFeatures.setBackground(SystemColor.window); springLayout.putConstraint(SpringLayout.NORTH, txtpnNewFeatures, 10, SpringLayout.NORTH, frmMinetestLauncherV.getContentPane()); springLayout.putConstraint(SpringLayout.WEST, txtpnNewFeatures, 10, SpringLayout.WEST, frmMinetestLauncherV.getContentPane()); springLayout.putConstraint(SpringLayout.SOUTH, txtpnNewFeatures, -10, SpringLayout.NORTH, btnDownloadPlay); springLayout.putConstraint(SpringLayout.EAST, txtpnNewFeatures, 0, SpringLayout.EAST, btnDownloadPlay); txtpnNewFeatures.setEditable(false); txtpnNewFeatures.setContentType("text/html"); txtpnNewFeatures.setText(changelog); txtpnNewFeatures.setFont(new Font("Tahoma", Font.PLAIN, 12)); frmMinetestLauncherV.getContentPane().add(txtpnNewFeatures); File file = new File(userhome + "\\minetest\\version.txt"); if (!file.exists()) newVersion = true; else { String version = fileGetter.getLocalContents(file, false); if (!version.equals(currentVersion)) newVersion = true; } if (newVersion) { label.setText("New Version Available! (" + currentVersion + ")"); btnDownloadPlay.setText("Download & Play"); btnDownloadPlay.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { Thread t = new Thread() { public void run() { File file = new File(userhome + "\\minetest\\version.txt"); String version = fileGetter.getLocalContents(file, false); try { FileUtils.deleteDirectory(new File(userhome + "\\minetest\\minetest-" + version)); } catch (Exception e) { e.printStackTrace(); } fileGetter.download(latest.split("\n")[1], userhome + "\\minetest\\temp\\", "minetest.zip", label, progressBar, btnDownloadPlay, currentVersion); try { label.setText("Cleaning up..."); btnDownloadPlay.setText("Cleaning up..."); FileUtils.deleteDirectory(new File(userhome + "\\minetest\\temp")); } catch (IOException e) { e.printStackTrace(); } System.exit(0); } }; t.start(); } }); } else { btnDownloadPlay.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { try { label.setText("Launching..."); btnDownloadPlay.setEnabled(false); btnDownloadPlay.setText("Launching..."); File file = new File(userhome + "\\minetest\\version.txt"); String version = fileGetter.getLocalContents(file, false); Runtime.getRuntime() .exec(userhome + "\\minetest\\minetest-" + version + "\\bin\\minetest.exe"); System.exit(0); } catch (IOException e) { e.printStackTrace(); } } }); progressBar.setValue(100); } }
From source file:com.hp.alm.ali.idea.content.settings.SettingsPanel.java
public SettingsPanel(final Project prj, Color bgColor) { this.prj = prj; this.projectConf = prj.getComponent(AliProjectConfiguration.class); previewAndConnection = new JPanel(new GridBagLayout()); previewAndConnection.setOpaque(false); GridBagConstraints c2 = new GridBagConstraints(); c2.gridx = 0;/* w w w . j a v a 2s .c o m*/ c2.gridy = 1; c2.gridwidth = 2; c2.weighty = 1; c2.fill = GridBagConstraints.VERTICAL; JPanel filler = new JPanel(); filler.setOpaque(false); previewAndConnection.add(filler, c2); passwordPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); passwordPanel.setBackground(bgColor); JLabel label = new JLabel("Password"); label.setFont(label.getFont().deriveFont(Font.BOLD)); passwordPanel.add(label); final JPasswordField password = new JPasswordField(24); passwordPanel.add(password); JButton connect = new JButton("Login"); passwordPanel.add(connect); final JLabel message = new JLabel(); passwordPanel.add(message); ActionListener connectionAction = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try { checkConnection(projectConf.getLocation(), projectConf.getDomain(), projectConf.getProject(), projectConf.getUsername(), password.getText()); } catch (AuthenticationFailed e) { message.setText(e.getMessage()); return; } projectConf.ALM_PASSWORD = password.getText(); projectConf.fireChanged(); } }; password.addActionListener(connectionAction); connect.addActionListener(connectionAction); restService = prj.getComponent(RestService.class); restService.addServerTypeListener(this); location = createTextPane(bgColor); domain = createTextPane(bgColor); project = createTextPane(bgColor); username = createTextPane(bgColor); final JPanel panel = new JPanel(new BorderLayout()); panel.setBackground(bgColor); panel.setBorder(new EmptyBorder(10, 10, 10, 10)); final JTextPane textPane = new JTextPane(); textPane.setEditorKit(new HTMLEditorKit()); textPane.setText( "<html><body>HP ALM integration can be configured on <a href=\"ide\">IDE</a> and overridden on <a href=\"project\">project</a> level.</body></html>"); textPane.setEditable(false); textPane.addHyperlinkListener(this); textPane.setBackground(bgColor); textPane.setCaret(new NonAdjustingCaret()); panel.add(textPane, BorderLayout.CENTER); JPanel content = new JPanel(new BorderLayout()); content.setBackground(bgColor); content.add(panel, BorderLayout.NORTH); content.add(previewAndConnection, BorderLayout.WEST); preview = new JPanel(new GridBagLayout()) { public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); // make enough room for the connection status message dim.width = Math.max(dim.width, 300); return dim; } public Dimension getMinimumSize() { return getPreferredSize(); } }; connectedTo(restService.getServerTypeIfAvailable()); preview.setBackground(bgColor); final GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 0; c.gridy = 0; c.gridwidth = 2; c.anchor = GridBagConstraints.WEST; preview.add(location, c); c.gridwidth = 1; c.gridy++; preview.add(domain, c); c.gridy++; preview.add(project, c); c.gridy++; preview.add(username, c); c.gridx++; c.gridy--; c.gridheight = 2; c.weightx = 0; c.anchor = GridBagConstraints.SOUTHEAST; final LinkLabel reload = new LinkLabel("Reload", IconLoader.getIcon("/actions/sync.png")); reload.setListener(new LinkListener() { public void linkSelected(LinkLabel linkLabel, Object o) { projectConf.fireChanged(); } }, null); preview.add(reload, c); JPanel previewNorth = new JPanel(new BorderLayout()); previewNorth.setBackground(bgColor); previewNorth.add(preview, BorderLayout.NORTH); addToGridBagPanel(0, 0, previewAndConnection, previewNorth); setBackground(bgColor); setLayout(new BorderLayout()); add(content, BorderLayout.CENTER); onChanged(); ApplicationManager.getApplication().getComponent(AliConfiguration.class).addListener(this); projectConf.addListener(this); }
From source file:edu.scripps.fl.pubchem.xmltool.gui.GUIComponent.java
public JTextPane createJTextPane(String text) { JTextPane jtp = new JTextPane(); jtp.setText(text);/*from www. j av a 2 s.co m*/ SimpleAttributeSet underline = new SimpleAttributeSet(); StyleConstants.setUnderline(underline, true); jtp.getStyledDocument().setCharacterAttributes(0, text.length(), underline, true); jtp.setEditable(false); jtp.setOpaque(false); jtp.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 10)); jtp.setBorder(BorderFactory.createEmptyBorder()); jtp.setForeground(Color.blue); jtp.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); return jtp; }
From source file:com.ethercamp.harmony.desktop.HarmonyDesktop.java
private void showErrorWindow(String title, String body) { try {/*from w w w. j a v a2 s . c o m*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // System.setProperty("apple.awt.UIElement", "false"); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); JTextArea textArea = new JTextArea(body); JScrollPane scrollPane = new JScrollPane(textArea); textArea.setLineWrap(true); textArea.setFont(Font.getFont(Font.MONOSPACED)); textArea.setEditable(false); textArea.setWrapStyleWord(true); scrollPane.setPreferredSize(new Dimension(500, 500)); JTextPane titleLabel = new JTextPane(); titleLabel.setContentType("text/html"); // let the text pane know this is what you want titleLabel.setText("<html>" + "<b>" + title + "</b>" + "</html>"); // showing off titleLabel.setEditable(false); titleLabel.setBackground(null); titleLabel.setBorder(null); panel.add(titleLabel); panel.add(scrollPane); final JFrame frame = new JFrame(); frame.setAlwaysOnTop(true); moveCenter(frame); frame.setVisible(true); JOptionPane.showMessageDialog(frame, panel, "Oops. Ethereum Harmony stopped with error.", JOptionPane.CLOSED_OPTION); System.exit(1); } catch (Exception e) { log.error("Problem showing error window", e); } }
From source file:it.iit.genomics.cru.igb.bundles.mi.view.MIResultPanel.java
public MIResultPanel(IgbService service, String summary, List<MIResult> results, String label, MIQuery query) { setLayout(new BorderLayout()); this.label = label; igbLogger = IGBLogger.getInstance(label); colorer = TaxonColorer.getColorer(query.getTaxid()); Box menuBox = new Box(BoxLayout.X_AXIS); Box buttonBox = new Box(BoxLayout.Y_AXIS); Box buttonBox1 = new Box(BoxLayout.X_AXIS); Box buttonBox3 = new Box(BoxLayout.X_AXIS); buttonBox.add(buttonBox1);/*from w w w.j a v a2 s .c o m*/ buttonBox.add(buttonBox3); JTextPane querySummary = new JTextPane(); querySummary.setContentType("text/html"); querySummary.setEditable(false); querySummary.setText(summary); menuBox.add(querySummary); menuBox.add(buttonBox); final JFrame logFrame = new JFrame("MI Bundle Log"); logFrame.setVisible(false); Dimension preferredSize = new Dimension(800, 500); logFrame.setPreferredSize(preferredSize); logFrame.setMinimumSize(preferredSize); logFrame.add(new LogPanel(igbLogger)); JButton log = new JButton(); if (igbLogger.hasError()) { log.setBackground(Color.red); } log.setIcon(CommonUtils.getInstance().getIcon("16x16/actions/console.png")); log.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { logFrame.setVisible(true); } }); buttonBox1.add(log); JButton networkButton = new JButton(""); networkButton.setIcon(new ImageIcon(getClass().getResource("/network.jpg"))); networkButton.addActionListener(new DisplayNetworkActionListener()); buttonBox1.add(networkButton); buttonBox1.add(new JSeparator(JSeparator.VERTICAL)); buttonBox1.add(new JLabel("Save: ")); JButton exportButton = new JButton("text"); exportButton.setIcon(CommonUtils.getInstance().getIcon("16x16/actions/save.png")); exportButton.addActionListener(new ExportActionListener()); if (false == MICommons.testVersion) { buttonBox1.add(exportButton); } JButton exportXgmmlButton = new JButton("xgmml"); exportXgmmlButton.setIcon(CommonUtils.getInstance().getIcon("16x16/actions/save.png")); exportXgmmlButton.addActionListener(new ExportXgmmlActionListener()); if (false == MICommons.testVersion) { buttonBox1.add(exportXgmmlButton); } buttonBox1.add(new JSeparator(JSeparator.VERTICAL)); buttonBox1.add(new JLabel("View structure: ")); structures = new StructuresPanel(service, label); buttonBox1.add(structures.getJmolButton()); buttonBox1.add(structures.getLinkButton()); // Filters ButtonGroup scoreGroup = new ButtonGroup(); JRadioButton scoreButton0 = new JRadioButton("<html>" + HTML_SCORE_0 + "</html>"); JRadioButton scoreButton1 = new JRadioButton("<html>" + HTML_SCORE_1 + "</html>"); JRadioButton scoreButton2 = new JRadioButton("<html>" + HTML_SCORE_2 + "</html>"); JRadioButton scoreButton3 = new JRadioButton("<html>" + HTML_SCORE_3 + "</html>"); scoreButton0.setSelected(true); ScoreListener scoreListener = new ScoreListener(); scoreButton0.addActionListener(scoreListener); scoreButton1.addActionListener(scoreListener); scoreButton2.addActionListener(scoreListener); scoreButton3.addActionListener(scoreListener); scoreGroup.add(scoreButton0); scoreGroup.add(scoreButton1); scoreGroup.add(scoreButton2); scoreGroup.add(scoreButton3); buttonBox1.add(new JSeparator(JSeparator.VERTICAL)); buttonBox1.add(new JLabel("Score: ")); buttonBox1.add(scoreButton0); buttonBox1.add(scoreButton1); buttonBox1.add(scoreButton2); buttonBox1.add(scoreButton3); buttonBox3.add(new JLabel("Interaction type: ")); JCheckBox EvidencePhysicalButton = new JCheckBox(HTML_CHECKBOX_PHYSICAL); JCheckBox EvidenceAssociationButton = new JCheckBox(HTML_CHECKBOX_ASSOCIATION); JCheckBox EvidenceEnzymaticButton = new JCheckBox(HTML_CHECKBOX_ENZYMATIC); JCheckBox EvidenceOtherButton = new JCheckBox(HTML_CHECKBOX_OTHER); JCheckBox EvidenceUnspecifiedButton = new JCheckBox(HTML_CHECKBOX_UNSPECIFIED); JCheckBox EvidenceStructureButton = new JCheckBox(HTML_CHECKBOX_STRUCTURE); EvidencePhysicalButton.setSelected(true); EvidenceAssociationButton.setSelected(true); EvidenceEnzymaticButton.setSelected(true); EvidenceOtherButton.setSelected(true); EvidenceUnspecifiedButton.setSelected(true); EvidenceStructureButton.setSelected(true); buttonBox3.add(EvidencePhysicalButton); buttonBox3.add(EvidenceAssociationButton); buttonBox3.add(EvidenceEnzymaticButton); buttonBox3.add(EvidenceOtherButton); buttonBox3.add(EvidenceUnspecifiedButton); buttonBox3.add(EvidenceStructureButton); EvidenceTypeListener evidenceListener = new EvidenceTypeListener(); EvidencePhysicalButton.addActionListener(evidenceListener); EvidenceAssociationButton.addActionListener(evidenceListener); EvidenceEnzymaticButton.addActionListener(evidenceListener); EvidenceOtherButton.addActionListener(evidenceListener); EvidenceUnspecifiedButton.addActionListener(evidenceListener); EvidenceStructureButton.addActionListener(evidenceListener); Box tableBox = new Box(BoxLayout.Y_AXIS); MITableModel model = new MITableModel(results); miTable = new MITable(model, service, query); miTable.setFillsViewportHeight(true); miTable.setStructuresPanel(structures); tableBox.add(miTable.getTableHeader()); tableBox.add(miTable); JScrollPane tableScroll = new JScrollPane(tableBox); tableScroll.setMinimumSize(new Dimension(800, 50)); tableScroll.setPreferredSize(new Dimension(800, 50)); tableScroll.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); structures.setMinimumSize(new Dimension(200, 500)); structures.setPreferredSize(new Dimension(200, 500)); structures.setMaximumSize(new Dimension(200, Short.MAX_VALUE)); resultBox = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tableScroll, structures); resultBox.setOneTouchExpandable(true); add(menuBox, BorderLayout.NORTH); add(resultBox, BorderLayout.CENTER); }
From source file:com.digitexx.ancestry.gui.FrmUpperLowerData.java
private void initGUI() { try {//from ww w . jav a2s .c o m this.setTitle("Uppercase & Lowercase data"); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); AnchorLayout thisLayout = new AnchorLayout(); getContentPane().setLayout(thisLayout); { panelMain = new JPanel(); BorderLayout panelMainLayout = new BorderLayout(); panelMain.setLayout(panelMainLayout); getContentPane().add(panelMain, new AnchorConstraint(0, 1000, 944, 0, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); panelMain.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); panelMain.setPreferredSize(new java.awt.Dimension(775, 488)); { splitPaneMain = new JSplitPane(); panelMain.add(splitPaneMain, BorderLayout.CENTER); splitPaneMain.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPaneMain.setDividerLocation(200); { panelColumnLog = new JPanel(); BorderLayout panelLogLayout = new BorderLayout(); panelColumnLog.setLayout(panelLogLayout); splitPaneMain.add(panelColumnLog, JSplitPane.RIGHT); panelColumnLog.setPreferredSize(new java.awt.Dimension(417, 482)); { splitPaneColumnAndLog = new JSplitPane(); panelColumnLog.add(splitPaneColumnAndLog, BorderLayout.CENTER); splitPaneColumnAndLog.setDividerLocation(200); { panelLog = new JPanel(); BorderLayout panelLogLayout1 = new BorderLayout(); panelLog.setLayout(panelLogLayout1); splitPaneColumnAndLog.add(panelLog, JSplitPane.RIGHT); { scrollPaneLog = new JScrollPane(); panelLog.add(scrollPaneLog, BorderLayout.CENTER); { textPaneLog = new JTextPane(); scrollPaneLog.setViewportView(textPaneLog); } } } { panelColumn = new JPanel(); BorderLayout panelColumnLayout = new BorderLayout(); panelColumn.setLayout(panelColumnLayout); splitPaneColumnAndLog.add(panelColumn, JSplitPane.LEFT); { scrollPaneColumn = new JScrollPane(); panelColumn.add(scrollPaneColumn, BorderLayout.CENTER); { tableField = new JTable() { @Override public boolean isCellEditable(int row, int column) { if (getColumnName(column).equals("Check")) { return true; } else { return false; } } @Override public Class<?> getColumnClass(int column) { if (getColumnName(column).equals("Check")) { return Boolean.class; } else { return super.getColumnClass(column); } } }; scrollPaneColumn.setViewportView(tableField); } } } } } { panelPath = new JPanel(); BorderLayout panelPathLayout = new BorderLayout(); panelPath.setLayout(panelPathLayout); splitPaneMain.add(panelPath, JSplitPane.LEFT); panelPath.setPreferredSize(new java.awt.Dimension(769, 316)); { scrollPanePath = new JScrollPane(); panelPath.add(scrollPanePath, BorderLayout.CENTER); { jListPath = new JList(); scrollPanePath.setViewportView(jListPath); jListPath.setFont(new java.awt.Font("Arial", 0, 14)); } } } } } { panelFooter = new JPanel(); AnchorLayout panelFooterLayout = new AnchorLayout(); getContentPane().add(panelFooter, new AnchorConstraint(944, 1000, 1000, 0, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); panelFooter.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); panelFooter.setLayout(panelFooterLayout); panelFooter.setPreferredSize(new java.awt.Dimension(775, 29)); { buttonRun = new JButton(); panelFooter.add(buttonRun, new AnchorConstraint(86, 998, 948, 890, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); buttonRun.setText("Run"); buttonRun.setFont(new java.awt.Font("Arial", 1, 16)); buttonRun.setPreferredSize(new java.awt.Dimension(83, 25)); buttonRun.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { buttonRunActionPerformed(evt); } }); } { checkboxRework = new JCheckBox(); panelFooter.add(checkboxRework, new AnchorConstraint(86, 155, 948, 3, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); checkboxRework.setText("Rework"); checkboxRework.setFont(new java.awt.Font("Arial", 1, 16)); checkboxRework.setForeground(new java.awt.Color(255, 0, 0)); checkboxRework.setPreferredSize(new java.awt.Dimension(118, 25)); checkboxRework.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { checkboxReworkActionPerformed(evt); } }); } } pack(); this.setSize(783, 551); AppUtility.centerFrame(this); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { exit(); } }); ; } catch (Exception e) { e.printStackTrace(); } }
From source file:com.egangotri.transliteratorAsSwing.TransliteratorJFrame.java
public TransliteratorJFrame() { super("eGangotri Indic Transliterator"); PrintWriter pw = new PrintWriter(System.out, true); setSize(650, 650);//from w w w . j a v a 2 s .co m // menubar menubar = new JMenuBar(); // menus file = new JMenu("File"); help = new JMenu("Help"); // JMenuItem save_1 = new JMenuItem("Save Input"); save_1.setActionCommand("save_1"); save_1.addActionListener(this); save_2 = new JMenuItem("Save Output-1"); save_2.setActionCommand("save_2"); save_2.addActionListener(this); save_3 = new JMenuItem("Save Output-2"); save_3.setActionCommand("save_3"); save_3.addActionListener(this); open_1 = new JMenuItem("Open File for Input"); open_1.setActionCommand("open_1"); open_1.addActionListener(this); exitItem = new JMenuItem("Exit"); exitItem.setActionCommand("Exit"); exitItem.addActionListener(this); aboutItem = new JMenuItem("About"); aboutItem.setActionCommand("about_item"); aboutItem.addActionListener(this); itransItem = new JMenuItem("ITRANS " + Constants.ENCODING_SCHEME); itransItem.setActionCommand("itrans_encoding"); itransItem.addActionListener(this); slpItem = new JMenuItem("SLP " + Constants.ENCODING_SCHEME); slpItem.setActionCommand("slp_encoding"); slpItem.addActionListener(this); hkItem = new JMenuItem("Harvard Kyoto " + Constants.ENCODING_SCHEME); hkItem.setActionCommand("hk_encoding"); hkItem.addActionListener(this); velthuisItem = new JMenuItem("Velthuis " + Constants.ENCODING_SCHEME); velthuisItem.setActionCommand("velthuis_encoding"); velthuisItem.addActionListener(this); dvnItem = new JMenuItem("Devanagari " + Constants.ENCODING_SCHEME); dvnItem.setActionCommand("devanagari_encoding"); dvnItem.addActionListener(this); iastItem = new JMenuItem("IAST " + Constants.ENCODING_SCHEME); iastItem.setActionCommand("iast_encoding"); iastItem.addActionListener(this); // add menuitems to menu file.add(open_1); file.add(save_1); file.add(save_2); file.add(save_3); file.add(exitItem); help.add(aboutItem); help.add(itransItem); help.add(slpItem); help.add(hkItem); help.add(velthuisItem); help.add(dvnItem); help.add(iastItem); // add menus to menubar menubar.add(file); menubar.add(help); // menus end // JPanel Initilization p1 = new JPanel(new FlowLayout(FlowLayout.LEFT)); p1a = new JPanel(new BorderLayout()); p2 = new JPanel(); p3 = new JPanel(new FlowLayout(FlowLayout.LEFT)); p3a = new JPanel(new BorderLayout()); p4 = new JPanel(); p5 = new JPanel(new FlowLayout(FlowLayout.LEFT)); p5a = new JPanel(new BorderLayout()); p6 = new JPanel(); p6a = new JPanel(); p7 = new JPanel(); // JLabel Initialization label1 = new JLabel("Input:"); label2 = new JLabel("Output-1"); label3 = new JLabel("Output-2"); capitalize = new JCheckBox("Capitalize Extended Latin"); capitalize.setSelected(capitalizeIAST); capitalize.setActionCommand("capitalize"); capitalize.addActionListener(this); // Buttons clearButton = new JButton("Clear"); clearButton.setActionCommand("clear"); clearButton.setToolTipText("Clear all Fields"); refreshButton = new JButton("Refresh"); refreshButton.setActionCommand("refresh"); refreshButton.setToolTipText("Refesh the View"); exitButton = new JButton("Exit"); exitButton.setActionCommand("Exit"); exitButton.setToolTipText("Quit the Application."); clipboardButton1 = new JButton("Clipboard"); clipboardButton1.setActionCommand("clipboard-1"); clipboardButton1.setToolTipText("Clipboard Input"); clipboardButton2 = new JButton("Clipboard"); clipboardButton2.setActionCommand("clipboard-2"); clipboardButton2.setToolTipText("Clipboard Output-1"); clipboardButton3 = new JButton("Clipboard"); clipboardButton3.setActionCommand("clipboard-3"); clipboardButton3.setToolTipText("Clipboard Output-2"); clearButton.addActionListener(this); refreshButton.addActionListener(this); exitButton.addActionListener(this); clipboardButton1.addActionListener(this); clipboardButton2.addActionListener(this); clipboardButton3.addActionListener(this); Container contentPane = getContentPane(); // JTextBox tb1 = new JTextArea(new PlainDocument(), null, 6, 45); tb1.setLineWrap(true); tb1.setWrapStyleWord(true); tb1.addKeyListener(this); tb2 = new JTextArea(new PlainDocument(), null, 6, 45); tb2.setLineWrap(true); tb2.setWrapStyleWord(true); tb2.addKeyListener(this); tb3 = new JTextArea(new PlainDocument(), null, 6, 45); tb3.setLineWrap(true); tb3.setWrapStyleWord(true); tb3.addKeyListener(this); // Setting Fonts Font unicodeFont = new Font(Constants.ARIAL_UNICODE_MS, Font.PLAIN, Constants.FONT_SIZE); tb1.setFont(unicodeFont); tb2.setFont(unicodeFont); tb3.setFont(unicodeFont); comboBox1 = new JComboBox(Constants.ENCODINGS.toArray()); comboBox1.setActionCommand("comboBox1"); comboBox1.setSelectedItem(Constants.ITRANS); comboBox1.addActionListener(this); comboBox2 = new JComboBox(Constants.ENCODINGS.toArray()); comboBox2.setActionCommand("comboBox2"); comboBox2.setSelectedItem(Constants.UNICODE_DVN); comboBox2.addActionListener(this); comboBox3 = new JComboBox(Constants.ENCODINGS.toArray()); comboBox3.setActionCommand("comboBox3"); comboBox3.setSelectedItem(Constants.IAST); comboBox3.addActionListener(this); /** *EXPERIMENT*** */ textPane = new JTextPane(); RTFEditorKit rtfkit = new RTFEditorKit(); // HTMLEditorKit htmlkit = new HTMLEditorKit(); textPane.setEditorKit(rtfkit); // set Kit which will read RTF Doc // textPane.setEditorKit(htmlkit); textPane.setEditable(false); // make uneditable textPane.setPreferredSize(new Dimension(200, 200)); textPane.setText(""); // set p1.add(label1); p1a.add(comboBox1, BorderLayout.LINE_END); p1a.add(clipboardButton1, BorderLayout.LINE_START); p2.add(new JScrollPane(tb1)); p3.add(label2); p3a.add(comboBox2, BorderLayout.LINE_END); p3a.add(clipboardButton2, BorderLayout.LINE_START); p4.add(new JScrollPane(tb2)); p5.add(label3); p5a.add(comboBox3, BorderLayout.LINE_END); p5a.add(clipboardButton3, BorderLayout.LINE_START); p6.add(new JScrollPane(tb3)); p6a.add(capitalize); p7.add(clearButton); p7.add(refreshButton); p7.add(exitButton); this.setJMenuBar(menubar); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); contentPane.add(p1); contentPane.add(p1a); contentPane.add(p2); contentPane.add(p3); contentPane.add(p3a); contentPane.add(p4); contentPane.add(p5); contentPane.add(p5a); contentPane.add(p6); contentPane.add(p6a); contentPane.add(p7); }
From source file:customize.swing.startMain.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - unknown panel1 = new JPanel(); JPanel panel2 = new JPanel(); JScrollPane scrollPane1 = new JScrollPane(); JPanel panel3 = new JPanel(); JPanel panel4 = new JPanel(); JPanel panel5 = new JPanel(); textField6 = new JTextField(); JPanel panel6 = new JPanel(); JLabel label1 = new JLabel(); JPanel panel7 = new JPanel(); JLabel label2 = new JLabel(); JPanel panel8 = new JPanel(); JLabel label3 = new JLabel(); JPanel panel9 = new JPanel(); textField2 = new JTextField(); ButtonView = new JButton(); JPanel panel10 = new JPanel(); textField7 = new JTextField(); JPanel panel11 = new JPanel(); textField1 = new JTextField(); JPanel panel12 = new JPanel(); JLabel label4 = new JLabel(); JPanel panel13 = new JPanel(); CheckBox1 = new JCheckBox(); CheckBox2 = new JCheckBox(); JPanel panel14 = new JPanel(); genButton = new JButton(); JScrollPane scrollPane2 = new JScrollPane(); JPanel panel15 = new JPanel(); JPanel panel16 = new JPanel(); TextField = new JTextField(); JPanel panel17 = new JPanel(); textField3 = new JTextField(); JPanel panel18 = new JPanel(); rootTextField = new JTextField(); JPanel panel19 = new JPanel(); PasswordField = new JPasswordField(); JPanel panel20 = new JPanel(); textField8 = new JTextField(); JPanel panel21 = new JPanel(); JLabel label5 = new JLabel(); JPanel panel22 = new JPanel(); JLabel label6 = new JLabel(); JPanel panel23 = new JPanel(); JLabel label7 = new JLabel(); JPanel panel24 = new JPanel(); JLabel label8 = new JLabel(); JPanel panel25 = new JPanel(); JLabel label9 = new JLabel(); JScrollPane scrollPane3 = new JScrollPane(); jscrollPane1 = new JTextPane(); //======== panel1 ======== {/* w w w . jav a2s . c om*/ // JFormDesigner evaluation mark panel1.setBorder(new javax.swing.border.CompoundBorder( new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0), "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red), panel1.getBorder())); panel1.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); panel1.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1)); //======== panel2 ======== { panel2.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); //======== scrollPane1 ======== { scrollPane1.setBorder(new TitledBorder("\u6587\u4ef6\u751f\u6210\u5730\u5740")); //======== panel3 ======== { panel3.setLayout(new GridLayoutManager(4, 2, new Insets(0, 0, 0, 0), -1, -1)); //======== panel4 ======== { panel4.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //======== panel5 ======== { panel5.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- textField6 ---- textField6.setEditable(true); textField6.setEnabled(true); textField6.setText(""); textField6.putClientProperty("html.disable", false); panel5.add(textField6, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel4.add(panel5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); } panel3.add(panel4, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel6 ======== { panel6.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- label1 ---- label1.setText("xml\u751f\u6210\u5728\u54ea\u4e2a\u5305\u540d\u4e0b"); panel6.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel3.add(panel6, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel7 ======== { panel7.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- label2 ---- label2.setText("model\u751f\u6210\u5728\u54ea\u4e2a\u5305\u540d\u4e0b"); panel7.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel3.add(panel7, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel8 ======== { panel8.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- label3 ---- label3.setText("\u6587\u4ef6\u7edf\u4e00\u751f\u6210\u8def\u5f84"); panel8.add(label3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel3.add(panel8, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel9 ======== { panel9.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); panel9.add(textField2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); //---- ButtonView ---- ButtonView.setText("\u6d4f\u89c8"); panel9.add(ButtonView, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel3.add(panel9, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel10 ======== { panel10.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- textField7 ---- textField7.setEditable(true); textField7.setEnabled(true); textField7.setText(""); textField7.putClientProperty("html.disable", true); panel10.add(textField7, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel3.add(panel10, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel11 ======== { panel11.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- textField1 ---- textField1.setEditable(true); textField1.setEnabled(true); textField1.setText(""); textField1.putClientProperty("html.disable", true); panel11.add(textField1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel3.add(panel11, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel12 ======== { panel12.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- label4 ---- label4.setText("dao\u5c42\u751f\u6210\u5728\u54ea\u4e2a\u5305\u540d\u4e0b"); panel12.add(label4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel3.add(panel12, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); } scrollPane1.setViewportView(panel3); } panel2.add(scrollPane1, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null)); } panel1.add(panel2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel13 ======== { panel13.setBorder(new TitledBorder("\u53ef\u914d\u7f6e\u9879")); panel13.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); //---- CheckBox1 ---- CheckBox1.setSelected(true); CheckBox1.setText("\u662f\u5426\u4e3a\u9a7c\u5cf0\u547d\u540d\u89c4\u8303"); panel13.add(CheckBox1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); //---- CheckBox2 ---- CheckBox2.setSelected(true); CheckBox2.setText("\u662f\u5426\u751f\u6210\u6ce8\u91ca"); panel13.add(CheckBox2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel1.add(panel13, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel14 ======== { panel14.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- genButton ---- genButton.setText("\u751f\u6210"); panel14.add(genButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel1.add(panel14, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== scrollPane2 ======== { scrollPane2.setBorder(new TitledBorder("\u5fc5\u586b\u9879")); //======== panel15 ======== { panel15.setLayout(new GridLayoutManager(5, 2, new Insets(0, 0, 0, 0), -1, -1)); //======== panel16 ======== { panel16.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- TextField ---- TextField.setText("com.mysql.jdbc.Driver"); panel16.add(TextField, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel15.add(panel16, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel17 ======== { panel17.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- textField3 ---- textField3.setText("jdbc:mysql://192.168.0.13/mvp?characterEncoding=UTF-8"); panel17.add(textField3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel15.add(panel17, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel18 ======== { panel18.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- rootTextField ---- rootTextField.setText("root"); panel18.add(rootTextField, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel15.add(panel18, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel19 ======== { panel19.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- PasswordField ---- PasswordField.setText("elab@123"); panel19.add(PasswordField, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel15.add(panel19, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel20 ======== { panel20.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- textField8 ---- textField8.setText(""); panel20.add(textField8, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel15.add(panel20, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel21 ======== { panel21.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- label5 ---- label5.setText("\u6570\u636e\u5e93\u9a71\u52a8:"); panel21.add(label5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel15.add(panel21, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel22 ======== { panel22.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- label6 ---- label6.setText("\u6570\u636e\u5e93\u8fde\u63a5\u5730\u5740:"); panel22.add(label6, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel15.add(panel22, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel23 ======== { panel23.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- label7 ---- label7.setText("\u6570\u636e\u5e93\u7528\u6237\u540d:"); panel23.add(label7, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel15.add(panel23, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel24 ======== { panel24.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- label8 ---- label8.setText("\u6570\u636e\u5e93\u5bc6\u7801:"); panel24.add(label8, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel15.add(panel24, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); //======== panel25 ======== { panel25.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); //---- label9 ---- label9.setText("\u8868\u540d(\u53ef\u6a21\u7cca%)"); panel25.add(label9, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null)); } panel15.add(panel25, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null)); } scrollPane2.setViewportView(panel15); } panel1.add(scrollPane2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null)); //======== scrollPane3 ======== { scrollPane3.setBorder(new TitledBorder("\u6ce8\u610f\u4e8b\u9879")); //---- jscrollPane1 ---- jscrollPane1.setEditable(true); jscrollPane1.setEnabled(true); jscrollPane1.setText( "\t1.\u8bf7\u4e0d\u8981\u91cd\u590d\u751f\u6210\u540c\u6837\u7684\u6587\u4ef6\u5728\u540c\u4e00\u4e2a\u76ee\u5f55\u5939\u4e0b\u3002"); scrollPane3.setViewportView(jscrollPane1); } panel1.add(scrollPane3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null)); } // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:edu.scripps.fl.pubchem.xmltool.gui.GUIComponent.java
public JTextPane createJTextPane() { String newline = "\n"; String[] description = { "PubChem XML Tool (Version: " + version + ")" + newline, "By: S. Canny (scanny@scripps.edu) and M. Southern (southern@scripps.edu)" + newline, "" + newline, "PubChem XML Tool main functions:" + newline, "1. Create a PubChem XML that can include Assay, Result TIDs, Xrefs, Panel, and Categorized Comments." + newline,//from www . j a v a2 s .c o m "2. Extract Assay, Result TID, Xref, Panel, and Categorized Comment information from a PubChem XML." + newline, "3. Create a report from an Excel workbook or PubChem XMLs." + newline, "" + newline, "Other features:" + newline, "1. Automatically adds reference section to description of PubChem XML or a report if placeholder is used." + newline, "2. Checks proteins, genes, omims, and taxonomies for connections when creating PubChem XML or a report." + newline, "3. Can retrieve on-hold and newly deposited assays from deposition system to extract or create report." + newline, "" + newline, "\t\t\t(c) 2010, The Scripps Research Institute- Florida" }; String[] styles = { "bold", "regular", "regular", "regular", "regular", "regular", "regular", "regular", "regular", "regular", "regular", "regular", "regular", "regular", "right" }; JTextPane jtp = new JTextPane(); StyledDocument doc = jtp.getStyledDocument(); addStylesToDocument(doc); try { for (int ii = 0; ii < description.length; ii++) doc.insertString(doc.getLength(), description[ii], doc.getStyle(styles[ii])); } catch (BadLocationException ble) { log.error(ble.getMessage(), ble); } jtp.setOpaque(false); jtp.setEditable(false); jtp.setPreferredSize(new Dimension(640, 230)); return jtp; }
From source file:ca.phon.ipadictionary.ui.IPALookupPanel.java
private void init() { setLayout(new BorderLayout()); // // start our worker thread // worker = PhonWorker.createWorker(); // worker.start(); console = new JTextPane(); console.setEditable(false);//from ww w .j a v a2 s. c o m console.setStyledDocument(new IPALookupDocument()); inputField = new JTextField(); inputField.addActionListener(new QueryActionListener()); add(new JScrollPane(console), BorderLayout.CENTER); add(inputField, BorderLayout.SOUTH); }