亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? textsamplerdemo.java

?? java tutotrials or beginners
?? JAVA
字號:
/* * Copyright (c) 1995 - 2008 Sun Microsystems, Inc.  All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * *   - Redistributions of source code must retain the above copyright *     notice, this list of conditions and the following disclaimer. * *   - Redistributions in binary form must reproduce the above copyright *     notice, this list of conditions and the following disclaimer in the *     documentation and/or other materials provided with the distribution. * *   - Neither the name of Sun Microsystems nor the names of its *     contributors may be used to endorse or promote products derived *     from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package components;/* * TextSamplerDemo.java requires the following files: *   TextSamplerDemoHelp.html (which references images/dukeWaveRed.gif) *   images/Pig.gif *   images/sound.gif */import javax.swing.*;import javax.swing.text.*;import java.awt.*;              //for layout managers and moreimport java.awt.event.*;        //for action eventsimport java.net.URL;import java.io.IOException;public class TextSamplerDemo extends JPanel                             implements ActionListener {    private String newline = "\n";    protected static final String textFieldString = "JTextField";    protected static final String passwordFieldString = "JPasswordField";    protected static final String ftfString = "JFormattedTextField";    protected static final String buttonString = "JButton";    protected JLabel actionLabel;    public TextSamplerDemo() {        setLayout(new BorderLayout());        //Create a regular text field.        JTextField textField = new JTextField(10);        textField.setActionCommand(textFieldString);        textField.addActionListener(this);        //Create a password field.        JPasswordField passwordField = new JPasswordField(10);        passwordField.setActionCommand(passwordFieldString);        passwordField.addActionListener(this);        //Create a formatted text field.        JFormattedTextField ftf = new JFormattedTextField(                java.util.Calendar.getInstance().getTime());        ftf.setActionCommand(textFieldString);        ftf.addActionListener(this);        //Create some labels for the fields.        JLabel textFieldLabel = new JLabel(textFieldString + ": ");        textFieldLabel.setLabelFor(textField);        JLabel passwordFieldLabel = new JLabel(passwordFieldString + ": ");        passwordFieldLabel.setLabelFor(passwordField);        JLabel ftfLabel = new JLabel(ftfString + ": ");        ftfLabel.setLabelFor(ftf);        //Create a label to put messages during an action event.        actionLabel = new JLabel("Type text in a field and press Enter.");        actionLabel.setBorder(BorderFactory.createEmptyBorder(10,0,0,0));        //Lay out the text controls and the labels.        JPanel textControlsPane = new JPanel();        GridBagLayout gridbag = new GridBagLayout();        GridBagConstraints c = new GridBagConstraints();        textControlsPane.setLayout(gridbag);        JLabel[] labels = {textFieldLabel, passwordFieldLabel, ftfLabel};        JTextField[] textFields = {textField, passwordField, ftf};        addLabelTextRows(labels, textFields, gridbag, textControlsPane);        c.gridwidth = GridBagConstraints.REMAINDER; //last        c.anchor = GridBagConstraints.WEST;        c.weightx = 1.0;        textControlsPane.add(actionLabel, c);        textControlsPane.setBorder(                BorderFactory.createCompoundBorder(                                BorderFactory.createTitledBorder("Text Fields"),                                BorderFactory.createEmptyBorder(5,5,5,5)));        //Create a text area.        JTextArea textArea = new JTextArea(                "This is an editable JTextArea. " +                "A text area is a \"plain\" text component, " +                "which means that although it can display text " +                "in any font, all of the text is in the same font."        );        textArea.setFont(new Font("Serif", Font.ITALIC, 16));        textArea.setLineWrap(true);        textArea.setWrapStyleWord(true);        JScrollPane areaScrollPane = new JScrollPane(textArea);        areaScrollPane.setVerticalScrollBarPolicy(                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);        areaScrollPane.setPreferredSize(new Dimension(250, 250));        areaScrollPane.setBorder(            BorderFactory.createCompoundBorder(                BorderFactory.createCompoundBorder(                                BorderFactory.createTitledBorder("Plain Text"),                                BorderFactory.createEmptyBorder(5,5,5,5)),                areaScrollPane.getBorder()));        //Create an editor pane.        JEditorPane editorPane = createEditorPane();        JScrollPane editorScrollPane = new JScrollPane(editorPane);        editorScrollPane.setVerticalScrollBarPolicy(                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);        editorScrollPane.setPreferredSize(new Dimension(250, 145));        editorScrollPane.setMinimumSize(new Dimension(10, 10));        //Create a text pane.        JTextPane textPane = createTextPane();        JScrollPane paneScrollPane = new JScrollPane(textPane);        paneScrollPane.setVerticalScrollBarPolicy(                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);        paneScrollPane.setPreferredSize(new Dimension(250, 155));        paneScrollPane.setMinimumSize(new Dimension(10, 10));        //Put the editor pane and the text pane in a split pane.        JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,                                              editorScrollPane,                                              paneScrollPane);        splitPane.setOneTouchExpandable(true);        splitPane.setResizeWeight(0.5);        JPanel rightPane = new JPanel(new GridLayout(1,0));        rightPane.add(splitPane);        rightPane.setBorder(BorderFactory.createCompoundBorder(                        BorderFactory.createTitledBorder("Styled Text"),                        BorderFactory.createEmptyBorder(5,5,5,5)));        //Put everything together.        JPanel leftPane = new JPanel(new BorderLayout());        leftPane.add(textControlsPane,                      BorderLayout.PAGE_START);        leftPane.add(areaScrollPane,                     BorderLayout.CENTER);        add(leftPane, BorderLayout.LINE_START);        add(rightPane, BorderLayout.LINE_END);    }    private void addLabelTextRows(JLabel[] labels,                                  JTextField[] textFields,                                  GridBagLayout gridbag,                                  Container container) {        GridBagConstraints c = new GridBagConstraints();        c.anchor = GridBagConstraints.EAST;        int numLabels = labels.length;        for (int i = 0; i < numLabels; i++) {            c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last            c.fill = GridBagConstraints.NONE;      //reset to default            c.weightx = 0.0;                       //reset to default            container.add(labels[i], c);            c.gridwidth = GridBagConstraints.REMAINDER;     //end row            c.fill = GridBagConstraints.HORIZONTAL;            c.weightx = 1.0;            container.add(textFields[i], c);        }    }    public void actionPerformed(ActionEvent e) {        String prefix = "You typed \"";        if (textFieldString.equals(e.getActionCommand())) {            JTextField source = (JTextField)e.getSource();            actionLabel.setText(prefix + source.getText() + "\"");        } else if (passwordFieldString.equals(e.getActionCommand())) {            JPasswordField source = (JPasswordField)e.getSource();            actionLabel.setText(prefix + new String(source.getPassword())                                + "\"");        } else if (buttonString.equals(e.getActionCommand())) {            Toolkit.getDefaultToolkit().beep();        }    }    private JEditorPane createEditorPane() {        JEditorPane editorPane = new JEditorPane();        editorPane.setEditable(false);        java.net.URL helpURL = TextSamplerDemo.class.getResource(                                        "TextSamplerDemoHelp.html");        if (helpURL != null) {            try {                editorPane.setPage(helpURL);            } catch (IOException e) {                System.err.println("Attempted to read a bad URL: " + helpURL);            }        } else {            System.err.println("Couldn't find file: TextSampleDemoHelp.html");        }        return editorPane;    }    private JTextPane createTextPane() {        String[] initString =                { "This is an editable JTextPane, ",            //regular                  "another ",                                   //italic                  "styled ",                                    //bold                  "text ",                                      //small                  "component, ",                                //large                  "which supports embedded components..." + newline,//regular                  " " + newline,                                //button                  "...and embedded icons..." + newline,         //regular                  " ",                                          //icon                  newline + "JTextPane is a subclass of JEditorPane that " +                    "uses a StyledEditorKit and StyledDocument, and provides " +                    "cover methods for interacting with those objects."                 };        String[] initStyles =                { "regular", "italic", "bold", "small", "large",                  "regular", "button", "regular", "icon",                  "regular"                };        JTextPane textPane = new JTextPane();        StyledDocument doc = textPane.getStyledDocument();        addStylesToDocument(doc);        try {            for (int i=0; i < initString.length; i++) {                doc.insertString(doc.getLength(), initString[i],                                 doc.getStyle(initStyles[i]));            }        } catch (BadLocationException ble) {            System.err.println("Couldn't insert initial text into text pane.");        }        return textPane;    }    protected void addStylesToDocument(StyledDocument doc) {        //Initialize some styles.        Style def = StyleContext.getDefaultStyleContext().                        getStyle(StyleContext.DEFAULT_STYLE);        Style regular = doc.addStyle("regular", def);        StyleConstants.setFontFamily(def, "SansSerif");        Style s = doc.addStyle("italic", regular);        StyleConstants.setItalic(s, true);        s = doc.addStyle("bold", regular);        StyleConstants.setBold(s, true);        s = doc.addStyle("small", regular);        StyleConstants.setFontSize(s, 10);        s = doc.addStyle("large", regular);        StyleConstants.setFontSize(s, 16);        s = doc.addStyle("icon", regular);        StyleConstants.setAlignment(s, StyleConstants.ALIGN_CENTER);        ImageIcon pigIcon = createImageIcon("images/Pig.gif",                                            "a cute pig");        if (pigIcon != null) {            StyleConstants.setIcon(s, pigIcon);        }        s = doc.addStyle("button", regular);        StyleConstants.setAlignment(s, StyleConstants.ALIGN_CENTER);        ImageIcon soundIcon = createImageIcon("images/sound.gif",                                              "sound icon");        JButton button = new JButton();        if (soundIcon != null) {            button.setIcon(soundIcon);        } else {            button.setText("BEEP");        }        button.setCursor(Cursor.getDefaultCursor());        button.setMargin(new Insets(0,0,0,0));        button.setActionCommand(buttonString);        button.addActionListener(this);        StyleConstants.setComponent(s, button);    }    /** Returns an ImageIcon, or null if the path was invalid. */    protected static ImageIcon createImageIcon(String path,                                               String description) {        java.net.URL imgURL = TextSamplerDemo.class.getResource(path);        if (imgURL != null) {            return new ImageIcon(imgURL, description);        } else {            System.err.println("Couldn't find file: " + path);            return null;        }    }    /**     * Create the GUI and show it.  For thread safety,     * this method should be invoked from the     * event dispatch thread.     */    private static void createAndShowGUI() {        //Create and set up the window.        JFrame frame = new JFrame("TextSamplerDemo");        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        //Add content to the window.        frame.add(new TextSamplerDemo());        //Display the window.        frame.pack();        frame.setVisible(true);    }    public static void main(String[] args) {        //Schedule a job for the event dispatching thread:        //creating and showing this application's GUI.        SwingUtilities.invokeLater(new Runnable() {            public void run() {                 //Turn off metal's use of bold fonts		UIManager.put("swing.boldMetal", Boolean.FALSE);		createAndShowGUI();            }        });    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
奇米四色…亚洲| 亚洲高清免费视频| 国产suv精品一区二区三区| xf在线a精品一区二区视频网站| 美美哒免费高清在线观看视频一区二区 | 亚洲日穴在线视频| 99久久精品免费看国产| 亚洲欧美日韩久久精品| 欧美日韩一二区| 日本怡春院一区二区| 欧美xxxxxxxxx| 成人av在线资源| 亚洲成人777| 精品国产乱码久久久久久闺蜜| 国产美女视频91| 亚洲三级在线观看| 777色狠狠一区二区三区| 国产麻豆日韩欧美久久| 国产精品超碰97尤物18| 欧美色图激情小说| 国产在线看一区| 亚洲欧洲精品一区二区精品久久久| 色欧美日韩亚洲| 久久er99精品| 亚洲人午夜精品天堂一二香蕉| 欧美三级在线播放| 国产盗摄精品一区二区三区在线| 日韩理论片中文av| 日韩一区和二区| 成人av网址在线| 秋霞午夜av一区二区三区| 国产欧美久久久精品影院| 欧美色窝79yyyycom| 激情另类小说区图片区视频区| 国产精品久久久久毛片软件| 欧美在线不卡视频| 国产精品亚洲第一区在线暖暖韩国 | 91麻豆精品在线观看| 天天影视涩香欲综合网| 国产精品区一区二区三| 欧美日韩精品一区二区三区 | 三级在线观看一区二区| 欧美韩国日本不卡| 欧美一级久久久| 欧美亚洲国产怡红院影院| 国产精品一区在线| 午夜精品一区二区三区免费视频 | 亚洲综合在线免费观看| 久久久久久久久久久久久夜| 欧美年轻男男videosbes| 99久久er热在这里只有精品66| 青椒成人免费视频| 亚洲国产日韩在线一区模特| 国产精品入口麻豆九色| 精品国免费一区二区三区| 欧美日韩大陆在线| 色综合久久久久久久| 成人精品免费视频| 国产在线视视频有精品| 视频一区在线播放| 亚洲国产精品久久不卡毛片 | 亚洲永久免费视频| 亚洲欧洲精品一区二区精品久久久 | 国产欧美一区二区三区鸳鸯浴| 91精品国产全国免费观看 | 欧美高清你懂得| 91精品福利在线| www.亚洲在线| 成人综合婷婷国产精品久久| 国产一区在线精品| 黑人巨大精品欧美一区| 毛片av一区二区| 美女爽到高潮91| 麻豆精品久久精品色综合| 日本午夜一本久久久综合| 亚洲国产日韩综合久久精品| 亚洲综合色网站| 亚洲国产中文字幕在线视频综合 | 中文字幕欧美区| 欧美国产视频在线| 欧美高清在线一区二区| 国产精品伦一区二区三级视频| 国产精品热久久久久夜色精品三区 | 欧美tickling网站挠脚心| 欧美电影免费观看完整版| 日韩欧美123| 国产日韩欧美综合一区| 国产精品免费丝袜| 国产精品二区一区二区aⅴ污介绍| 国产欧美一区二区在线观看| 国产精品对白交换视频| 亚洲人妖av一区二区| 亚洲制服丝袜av| 麻豆精品国产传媒mv男同| 毛片av一区二区三区| 国产成人在线视频播放| 91玉足脚交白嫩脚丫在线播放| 91九色02白丝porn| 91精品国产免费久久综合| 精品久久一区二区| 欧美国产激情一区二区三区蜜月| 国产精品久久久久久久久快鸭 | 国产亚洲一区二区三区在线观看| 久久九九99视频| 一区二区三区高清| 日本最新不卡在线| 福利电影一区二区| 欧美在线观看一区| xfplay精品久久| 亚洲另类中文字| 琪琪一区二区三区| 成a人片亚洲日本久久| 欧美日本韩国一区二区三区视频 | 91丨porny丨户外露出| 69久久夜色精品国产69蝌蚪网| 欧美成人综合网站| 亚洲欧美自拍偷拍色图| 五月婷婷另类国产| 国产不卡视频在线观看| 欧美性生交片4| 国产亚洲福利社区一区| 亚洲午夜久久久久久久久电影网| 国产制服丝袜一区| 欧美老女人第四色| 中文字幕av资源一区| 亚洲国产日韩精品| av电影在线观看一区| 日韩女优视频免费观看| 亚洲欧美国产毛片在线| 久久99久久精品欧美| 日本韩国一区二区三区| 欧美国产一区在线| 麻豆国产精品一区二区三区 | 8v天堂国产在线一区二区| 欧美激情一区二区| 精品一区二区三区视频在线观看| 一本一道久久a久久精品综合蜜臀| 久久丝袜美腿综合| 日韩精品乱码免费| 欧洲亚洲精品在线| 国产精品精品国产色婷婷| 另类的小说在线视频另类成人小视频在线| 99久久99久久久精品齐齐| 久久婷婷成人综合色| 免费人成黄页网站在线一区二区| 色综合久久综合| 成人免费一区二区三区在线观看| 国产综合久久久久影院| 3d成人h动漫网站入口| 亚洲色图一区二区三区| 国产成人aaa| 国产亚洲一本大道中文在线| 人禽交欧美网站| 91麻豆精品久久久久蜜臀| 香蕉成人伊视频在线观看| 91色九色蝌蚪| 亚洲人xxxx| 91免费版在线| 中文字幕字幕中文在线中不卡视频| 国产成人免费在线观看不卡| 久久天堂av综合合色蜜桃网| 久久精品国产99久久6| 欧美一区二区网站| 日韩电影在线一区二区| 欧美一区二区免费观在线| 日韩精品一二三四| 日韩视频一区在线观看| 奇米一区二区三区av| 日韩欧美激情四射| 久久av老司机精品网站导航| 日韩欧美一区二区久久婷婷| 青青草原综合久久大伊人精品| 制服丝袜中文字幕亚洲| 日韩av在线免费观看不卡| 欧美一区二区三区四区在线观看| 日韩国产欧美三级| 精品成人佐山爱一区二区| 国内成人免费视频| 国产精品久久影院| 91视频精品在这里| 亚洲成人综合在线| 日韩欧美www| 国产91清纯白嫩初高中在线观看| 国产人久久人人人人爽| jizz一区二区| 亚洲午夜av在线| 精品国产91九色蝌蚪| 风间由美一区二区av101| 国产精品久久久99| 欧美日韩国产美| 国产综合色视频| 亚洲免费成人av| 欧美一区二区网站| 国产suv精品一区二区三区| 亚洲欧美日韩在线| 91精品国产欧美一区二区成人| 国产精品一区二区不卡| 亚洲日本电影在线| 精品三级av在线| 色哟哟精品一区|