⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configdialog.java

📁 的说法科斯洛伐路上看到伐楼上的开发1科林麦克;
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        textJavaPath.setFont(new Font("宋体", 0, 12));
        textClassPath.setFont(new Font("宋体", 0, 12));
        textBrowserPath.setFont(new Font("宋体", 0, 12));
        textReferenceUrl.setFont(new Font("宋体", 0, 12));
        JPanel jpanel5 = new JPanel();
        jpanel5.setLayout(new GridLayout(1, 3, 10, 0));
        jpanel5.add(buttonAddProtoType);
        jpanel5.add(buttonEditProtoType);
        jpanel5.add(buttonRemoveProtoType);
        panelTab2.setLayout(new BorderLayout(0, 5));
        JPanel jpanel6 = new JPanel();
        jpanel6.setLayout(new GridLayout(4, 1, 0, 10));
        jpanel6.add(new JLabel("基础类型设定"));
        jpanel6.add(comboProtoType);
        jpanel6.add(jpanel5);
        jpanel6.add("South", buttonEditProtoTypeFile);
        panelTab2.add("North", jpanel6);
        buttonAddProtoType.addActionListener(this);
        buttonEditProtoType.addActionListener(this);
        buttonRemoveProtoType.addActionListener(this);
        buttonEditProtoTypeFile.addActionListener(this);
        JPanel jpanel7 = new JPanel();
        jpanel7.setLayout(new GridLayout(3, 1, 0, 10));
        jpanel7.add(checkCreateBatFile);
        jpanel7.add(checkCreateJarFile);
        jpanel7.add(checkCreateHtmlFile);
        panelTab3.setLayout(new BorderLayout());
        panelTab3.add("North", jpanel7);
        textSample.setEditable(false);
        textSample.setFont(new Font("宋体", 0, 16));
        JPanel jpanel8 = new JPanel();
        JPanel jpanel9 = new JPanel();
        JPanel jpanel10 = new JPanel();
        JPanel jpanel11 = new JPanel();
        jpanel9.setLayout(new GridLayout(6, 1));
        jpanel9.add(new JLabel("背景色:", 4));
        jpanel9.add(new JLabel("普通文字:", 4));
        jpanel9.add(new JLabel("关键字1:", 4));
        jpanel9.add(new JLabel("关键字2:", 4));
        jpanel9.add(new JLabel("文字:", 4));
        jpanel9.add(new JLabel("注释文字:", 4));
        jpanel10.setLayout(new GridLayout(6, 1));
        jpanel10.add(textLastBackgroundColor);
        jpanel10.add(textLastCharacterColor);
        jpanel10.add(textLastKeyWord1Color);
        jpanel10.add(textLastKeyWord2Color);
        jpanel10.add(textLastStringColor);
        jpanel10.add(textLastCommentColor);
        jpanel11.setLayout(new GridLayout(6, 1));
        jpanel11.add(buttonLastBackgroundColor);
        jpanel11.add(buttonLastCharacterColor);
        jpanel11.add(buttonLastKeyWord1Color);
        jpanel11.add(buttonLastKeyWord2Color);
        jpanel11.add(buttonLastStringColor);
        jpanel11.add(buttonLastCommentColor);
        jpanel8.setLayout(new BorderLayout());
        jpanel8.add("West", jpanel9);
        jpanel8.add("Center", jpanel10);
        jpanel8.add("East", jpanel11);
        panelTab4.setLayout(new BorderLayout());
        panelTab4.add("Center", textSample);
        panelTab4.add("South", jpanel8);
        buttonLastBackgroundColor.addActionListener(this);
        buttonLastCharacterColor.addActionListener(this);
        buttonLastKeyWord1Color.addActionListener(this);
        buttonLastKeyWord2Color.addActionListener(this);
        buttonLastStringColor.addActionListener(this);
        buttonLastCommentColor.addActionListener(this);
        JPanel jpanel12 = new JPanel();
        jpanel12.setLayout(new BorderLayout());
        jpanel12.add("West", new JLabel("Tab间隔"));
        jpanel12.add("Center", comboTabSpace);
        panelTab5.setLayout(new BorderLayout());
        panelTab5.add("North", jpanel12);
        setting();
        setSize(500, 400);
        setLocationRelativeTo(frame);
        setResizable(false);
    }

    public void setLookAndFeel()
    {
        LookAndFeel.setLookAndFeel(contentPane);
    }

    public void setting()
    {
        setting1();
        setting2();
        setting3();
        setting4();
        setting5();
    }

    public void setting1()
    {
        textJavaPath.setText(config.getJavaPath());
        textClassPath.setText(config.getClassPath());
        textBrowserPath.setText(config.getBrowserPath());
        textReferenceUrl.setText(config.getReferenceUrl());
    }

    public void setting2()
    {
        comboProtoType.removeAllItems();
        for(int i = 0; i < config.getProtoTypeLength(); i++)
            comboProtoType.addItem(config.getProtoTypeName(i) + "->" + config.getProtoTypePath(i));

    }

    public void setting3()
    {
        checkCreateBatFile.setSelected(config.getCreateBatFile());
        checkCreateJarFile.setSelected(config.getCreateJarFile());
        checkCreateHtmlFile.setSelected(config.getCreateHtmlFile());
    }

    public void setting4()
    {
        textLastBackgroundColor.setBackground(config.getLastBackgroundColor());
        textLastCharacterColor.setBackground(config.getLastCharacterColor());
        textLastKeyWord1Color.setBackground(config.getLastKeyWord1Color());
        textLastKeyWord2Color.setBackground(config.getLastKeyWord2Color());
        textLastStringColor.setBackground(config.getLastStringColor());
        textLastCommentColor.setBackground(config.getLastCommentColor());
        setSample(textLastBackgroundColor.getBackground(), textLastCharacterColor.getBackground(), textLastKeyWord1Color.getBackground(), textLastKeyWord2Color.getBackground(), textLastStringColor.getBackground(), textLastCommentColor.getBackground());
    }

    public void setting5()
    {
        comboTabSpace.setSelectedItem(config.getTabSpace());
    }

    public ConfigData getConfigData()
    {
        return config;
    }

    public void actionPerformed(ActionEvent actionevent)
    {
        Object obj = actionevent.getSource();
        String s = actionevent.getActionCommand();
        if(obj == buttonRet)
            retConfig();
        if(obj == buttonOk)
        {
            String s1 = textJavaPath.getText();
            String s9 = s1.substring(s1.length() - 1, s1.length());
            if(!s9.equals("\\") && !s9.equals("/"))
            {
                s1 = s1 + "\\";
                textJavaPath.setText(s1);
            }
            setConfig();

            JOptionPane.showMessageDialog(this, "关闭窗口后更新将生效。", "JavaIDE : 提示", 1);
            setVisible(false);
        }
        if(obj == buttonCancel)
        {
            setting();
            setVisible(false);
        }
        if(s.equals("浏览"))
        {
            if(obj == buttonJavaPath)
            {
                String s2 = textJavaPath.getText();
                fileChooser = new JFileChooser(s2);
                fileChooser.setFileSelectionMode(1);
            } else
            if(obj == buttonClassPath)
            {
                String s3 = textClassPath.getText();
                fileChooser = new JFileChooser(s3);
                fileChooser.setFileSelectionMode(1);
            } else
            {
                String s4 = textBrowserPath.getText();
                fileChooser = new JFileChooser(s4);
                fileChooser.setFileSelectionMode(0);
            }
            int j = fileChooser.showDialog(owner, "确定");
            if(j == 0)
            {
                String s5 = fileChooser.getSelectedFile().getAbsolutePath();
                if(obj == buttonJavaPath)
                    textJavaPath.setText(s5);
                else
                if(obj == buttonClassPath)
                    textClassPath.setText(s5);
                else
                    textBrowserPath.setText(s5);
            }
        }
        if(s.equals("设定"))
        {
            if(obj == buttonLastBackgroundColor)
            {
                Color color = textLastBackgroundColor.getBackground();
                colorChooser = new JColorChooser(color);
   
                color = JColorChooser.showDialog(this, "JavaIDE : 色彩设定", color);
                if(color != null)
                {
                    textLastBackgroundColor.setBackground(color);
                    setSample(color, textLastCharacterColor.getBackground(), textLastKeyWord1Color.getBackground(), textLastKeyWord2Color.getBackground(), textLastStringColor.getBackground(), textLastCommentColor.getBackground());
                }
            }
            if(obj == buttonLastCharacterColor)
            {
                Color color1 = textLastCharacterColor.getBackground();
                colorChooser = new JColorChooser(color1);

                color1 = JColorChooser.showDialog(this, "JavaIDE : 色彩设定", color1);
                if(color1 != null)
                {
                    textLastCharacterColor.setBackground(color1);
                    setSample(textLastBackgroundColor.getBackground(), color1, textLastKeyWord1Color.getBackground(), textLastKeyWord2Color.getBackground(), textLastStringColor.getBackground(), textLastCommentColor.getBackground());
                }
            }
            if(obj == buttonLastKeyWord1Color)
            {
                Color color2 = textLastKeyWord1Color.getBackground();
                colorChooser = new JColorChooser(color2);
     
                color2 = JColorChooser.showDialog(this, "JavaIDE : 色彩设定", color2);
                if(color2 != null)
                {
                    textLastKeyWord1Color.setBackground(color2);
                    setSample(textLastBackgroundColor.getBackground(), textLastCharacterColor.getBackground(), color2, textLastKeyWord2Color.getBackground(), textLastStringColor.getBackground(), textLastCommentColor.getBackground());
                }
            }
            if(obj == buttonLastKeyWord2Color)
            {
                Color color3 = textLastKeyWord2Color.getBackground();
                colorChooser = new JColorChooser(color3);

                color3 = JColorChooser.showDialog(this, "JavaIDE : 色彩设定", color3);
                if(color3 != null)
                {
                    textLastKeyWord2Color.setBackground(color3);
                    setSample(textLastBackgroundColor.getBackground(), textLastCharacterColor.getBackground(), textLastKeyWord1Color.getBackground(), color3, textLastStringColor.getBackground(), textLastCommentColor.getBackground());
                }
            }
            if(obj == buttonLastStringColor)
            {
                Color color4 = textLastStringColor.getBackground();
                colorChooser = new JColorChooser(color4);

                color4 = JColorChooser.showDialog(this, "JavaIDE : 色彩设定", color4);
                if(color4 != null)
                {
                    textLastStringColor.setBackground(color4);
                    setSample(textLastBackgroundColor.getBackground(), textLastCharacterColor.getBackground(), textLastKeyWord1Color.getBackground(), textLastKeyWord2Color.getBackground(), color4, textLastCommentColor.getBackground());
                }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -