<legend id='nvhfhprj'><style id='85t4j68r'><dir id='eh9l0ven'><q id='dzefecvp'></q></dir></style></legend>

    1. <i id='g9b9xwrf'><tr id='0a7477nb'><dt id='g5ttky15'><q id='jxsugawk'><span id='t03bwih5'><b id='233mpy5j'><form id='eso359zi'><ins id='b8kxtmo5'></ins><ul id='fnrh0uve'></ul><sub id='aivcvtso'></sub></form><legend id='0gznry49'></legend><bdo id='8pnteuln'><pre id='9h08ljt1'><center id='2klkz8h8'></center></pre></bdo></b><th id='15zxi0m5'></th></span></q></dt></tr></i><div id='cz0564x9'><tfoot id='2immisl9'></tfoot><dl id='ugim1sao'><fieldset id='ykhycmlu'></fieldset></dl></div>

      <small id='hsw2qbeu'></small><noframes id='ojdii3xl'>

        <tfoot id='oozro6c7'></tfoot>
          <bdo id='zml3issc'></bdo><ul id='kqrac5xm'></ul>
        欢迎来到入门教程网!

        Java编程

        当前位置:主页 > 软件编程 > Java编程 >

        java改变字体代码 java怎么改变字体

        来源:本站原创|时间:2023-04-10|栏目:Java编程|点击:

        Java中如何更换窗口标题栏字体(如何通过软件代码修改)

        复制以下代码,修改相应地方即可:

        private static void loadIndyFont()

        {

        UIManager.put("CheckBox.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("Tree.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("Viewport.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("ProgressBar.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("RadioButtonMenuItem.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("FormattedTextField.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("ToolBar.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("ColorChooser.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("ToggleButton.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("Panel.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("TextArea.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("Menu.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("RadioButtonMenuItem.acceleratorFont", new java.awt.Font("宋体", 0, 12));

        UIManager.put("Spinner.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("Menu.acceleratorFont", new java.awt.Font("宋体", 0, 12));

        UIManager.put("CheckBoxMenuItem.acceleratorFont", new java.awt.Font("宋体", 0, 12));

        UIManager.put("TableHeader.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("TextField.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("OptionPane.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("MenuBar.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("Button.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("Label.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("PasswordField.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("InternalFrame.titleFont", new java.awt.Font("宋体", 0, 12));

        UIManager.put("OptionPane.buttonFont", new java.awt.Font("宋体", 0, 12));

        UIManager.put("ScrollPane.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("MenuItem.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("ToolTip.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("List.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("OptionPane.messageFont", new java.awt.Font("宋体", 0, 12));

        UIManager.put("EditorPane.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("Table.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("TabbedPane.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("RadioButton.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("CheckBoxMenuItem.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("TextPane.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("PopupMenu.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("TitledBorder.font", new java.awt.Font("宋体", 0, 12));

        UIManager.put("ComboBox.font", new java.awt.Font("宋体", 0, 12));

        }

        Java中设置字体

        java中没有自带的字体对话框,这需要自己来编写。

        text.setFond("字体名字",字形(如,fond.bold),大小)

        import java.awt.*;

        import java.awt.event.*;

        import javax.swing.JColorChooser;

        //import javax.swing.border.*;

        class ff extends Frame implements ActionListener

        {

        Choice font,size,bolder;

        Button bb;

        ff(String s)

        {

        setTitle(s);

        font=new Choice();

        bolder=new Choice();

        size=new Choice();

        //bolder.add加监视器

        //font.add加监视器

        //size.add加监视器

        Panel p1=new Panel();

        Panel p2=new Panel();

        bb=new Button("点击打开");

        bb.addActionListener(this);

        p1.setLayout(new GridLayout(4,1));

        p2.setLayout(new GridLayout(4,1));

        GraphicsEnvironment gg=GraphicsEnvironment.getLocalGraphicsEnvironment();

        String ss[]=gg.getAvailableFontFamilyNames();

        String bold[]={"Font.BOLD","Font.CENTER_BASELINE","Font.CENTER_BASELINE","Font.ITALIC",

        "Font.PLAIN","Font.ROMAN_BASELINE","Font.TRUETYPE_FONT"};

        for(int i=126;iss.length;i++)

        font.add(ss[i]);

        for(int i=12;i=64;i+=2)

        {

        String w=String.valueOf(i);

        size.add(w);

        }

        for(int i=0;ibold.length;i++)

        {

        bolder.add(bold[i]);

        }

        p1.add(new Label("请选择字体"));

        p1.add(font);

        p1.add(new Label("请选择大小"));

        p1.add(size);

        p2.add(new Label("请选择字型"));

        p2.add(bolder);

        p2.add(new Label("请选择字体颜色"));

        p2.add(bb);

        add(p2,BorderLayout.WEST);

        add(p1,BorderLayout.EAST);

        setSize(250,150);

        setVisible(true);

        pack();

        addWindowListener(new WindowAdapter()

        {

        public void windowClosing(WindowEvent ee)

        {

        System.exit(0);

        }

        });

        }

        public void actionPerformed(ActionEvent e)

        {

        Color cc=JColorChooser.showDialog(this,"颜色对话框",null);

        bb.setBackground(cc);//应用举例

        }

        }

        public class font

        {

        public static void main(String[] args)

        {

        new ff("字体对话框");

        }

        }

        java用什么方法设置label的字体

        Java设置label字体代码如下:

        ublic class SetColor extends JFrame{

        JLabel jlabel = new JLabel("颜色,大小");

        public SetColor(){

          this.setLayout(null);

          jlabel.setBounds(0, 0, 200, 40);

          jlabel.setFont(new Font("",1,30));//设置字体大小

          jlabel.setForeground(Color.BLUE);//设置字体颜色

          this.add(jlabel);

          this.setSize(200,200);

          this.setVisible(true);

         }

         /**

        [email protected]

          */

         public static void main(String[] args) {

          // TODO Auto-generated method stub

          SetColor sc = new SetColor();

         }}

        java 如何设置字体格式?

        Java Swing中可以给每个控件设置字体格式和其他属性的设置,示例如下:\x0d\x0asubmit= new JButton("登陆");\x0d\x0asubmit.setFont(new Font("宋体", Font.PLAIN, 16));\x0d\x0a三个参数分别表示: 字体,样式(粗体,斜体等),字号\x0d\x0a submit.setForeground(Color.RED);\x0d\x0a这个表示给组件上的文字设置颜色Color.RED表示红色\x0d\x0a当然你也可以自己给RGB的值 比如 submit.setForeground(new Color(215,215,200));

        <tfoot id='rrojn303'></tfoot>
          <tbody id='byhrpnk3'></tbody>
        <legend id='wt96mz5j'><style id='m529xja5'><dir id='qwtpseq3'><q id='jbrdiw3f'></q></dir></style></legend>
            <bdo id='y47791de'></bdo><ul id='pyxiljj2'></ul>
            • <i id='z5joamq7'><tr id='aqixm789'><dt id='k313q1us'><q id='8nzuiye1'><span id='c3xeuiuh'><b id='uohq2s34'><form id='m6w5c18t'><ins id='3pept3ql'></ins><ul id='2s86exmr'></ul><sub id='07jk74wk'></sub></form><legend id='6ulqnrrk'></legend><bdo id='vpsltnwf'><pre id='s5jbwahb'><center id='kj3x7npb'></center></pre></bdo></b><th id='4ipihpf1'></th></span></q></dt></tr></i><div id='j0qnpzmn'><tfoot id='ouzynxm0'></tfoot><dl id='8n7vh68l'><fieldset id='xewfv7e8'></fieldset></dl></div>

                <small id='dw2bks9v'></small><noframes id='mqoobxgz'>

                  上一篇:java学习代码库 java代码教学

                  栏    目:Java编程

                  下一篇:没有了

                  本文标题:java改变字体代码 java怎么改变字体

                  本文地址:https://www.xiuzhanwang.com/a1/Javabiancheng/17351.html

                  网页制作CMS教程网络编程软件编程脚本语言数据库服务器

                  如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

                  联系QQ:835971066 | 邮箱:835971066#qq.com(#换成@)

                  Copyright © 2002-2020 脚本教程网 版权所有

                  <i id='le11i6dp'><tr id='60mu4mcq'><dt id='y8hh909h'><q id='dwygxa5q'><span id='bcueduyw'><b id='wr6l0ieu'><form id='6isadq5x'><ins id='ydgxmrz8'></ins><ul id='17p745v2'></ul><sub id='68v8zwgr'></sub></form><legend id='sq3nc2fz'></legend><bdo id='vsbflkuf'><pre id='425633nk'><center id='2iy3ks8v'></center></pre></bdo></b><th id='s4tfjbba'></th></span></q></dt></tr></i><div id='7mkcy6no'><tfoot id='2psr7hgq'></tfoot><dl id='s99hi8op'><fieldset id='1rdmcqgc'></fieldset></dl></div>
                1. <tfoot id='heysgs0k'></tfoot>

                  1. <small id='5ooz9jx8'></small><noframes id='knt40jrx'>

                      <bdo id='021snyg7'></bdo><ul id='9j8epxzj'></ul>
                  2. <legend id='05lhzdco'><style id='038abkhg'><dir id='rutt8trc'><q id='4395v2z0'></q></dir></style></legend>