无法动态地将滚动条添加到jframe或调整屏幕大小

时间:2014-10-16 10:07:11

标签: java swing jframe jpanel

起初,对不起我的语言(我是法语而不是最好的英语) 我是java的新手,但我必须修复一个程序。这不是我的代码,所以我很难理解所有这些。我有一个Jframe与一些JButton,JLabel,Jtable ...问题:对于某些电脑屏幕,宽度太大,我们看不到几个元素。 我已经尝试使用滚动条来动态调整屏幕大小,但就像我说的那样,我是新手。

我无法向您展示代码,但我会尝试恢复这种情况。

public class maClasse extends JFrame {
    public static void updateProgressBar(final Integer type) {
        final SwingWorker<Integer, Void> worker = new SwingWorker<Integer, Void>() {
            @Override
            public Integer doInBackground() {
                try {

                        fenetrePrincipale = new Calcul(false);
                        fenetreIntro.setLocationRelativeTo(fenetreIntro
                                        .getParent());
                        fenetrePrincipale
                        .setLocationRelativeTo(fenetrePrincipale
                                        .getParent());

                        fenetrePrincipale.setVisible(true);

                        fenetrePrincipale
                        .addWindowListener(new java.awt.event.WindowAdapter() {

                            @Override
                            public
                            void
                            windowClosing(final java.awt.event.WindowEvent windowEvent) {
                                Log.ecrire(new File(Chemin
                                                .getCheminLog()),
                                                "INFO",
                                                "Programme quitté! (Code retour 1)");
                                System.exit(1);
                            }
                        });
    private static Calcul fenetrePrincipale;

    //more private ...

    public Calcul(final boolean loader) {
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        if (loader) {
            setTitle("Calcul de d\u00E9pendances");
            // setBounds(100, 100, 1058, 709);
            setExtendedState(Frame.MAXIMIZED_BOTH);
            contentPane = new JPanel();
            contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
            contentPane.setLayout(new MigLayout(
                            "",
                            "[91.00px,grow][25.00][7.00px,grow][grow][][][][][][][][][][][231.00][][][][26.00][][-33.00][][41.00][231.00][][][][][-16.00][][][][-29.00][][-15.00]",
                            "[44px][][][][][][239.00,grow][-231.00][][][245.00,grow][96.00,grow][]"));
            //a lot of Jbutton, Jlabel, Jtable with the command
            //contentPane.add(btnJbutton) ...

            setContentPane(contentPane);
     }

}

我认为JFrame的所有代码都在这里。你能帮我使用滚动条或动态调整Jframe的大小 谢谢你

0 个答案:

没有答案
相关问题