Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2007
    Messaggi
    561

    E' possibile fare un refresh di un JFrame

    vorrei sapere se è possibile fare un refresh di un JFrame perchè si rovina


    tulipan

  2. #2
    Utente di HTML.it L'avatar di andbin
    Registrato dal
    Jan 2006
    residenza
    Italy
    Messaggi
    18,284

    Re: E' possibile fare un refresh di un JFrame

    Originariamente inviato da tulipan
    vorrei sapere se è possibile fare un refresh di un JFrame perchè si rovina
    Se si "rovina" è perché magari non hai gestito il painting in modo corretto (se disegni su un "tuo" componente) o non hai rispettato le regole di threading di Swing o hai aggiunto dei componenti ad un container ma senza rivalidare il layout o altro.

    Senza vedere il codice mi servirebbe la famosa sfera di cristallo per dirlo.
    Andrea, andbin.devSenior Java developerSCJP 5 (91%) • SCWCD 5 (94%)
    java.util.function Interfaces Cheat SheetJava Versions Cheat Sheet

  3. #3
    Utente di HTML.it
    Registrato dal
    Jan 2007
    Messaggi
    561
    Eccolo:

    codice:
    import java.awt.Frame;
    import java.io.File;
    import java.io.FileWriter;
    import java.util.StringTokenizer;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import java.awt.Dimension;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Rectangle;
    import java.awt.SystemColor;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.IOException;
    import java.util.Vector;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JScrollBar;
    import javax.swing.JScrollPane;
    import javax.swing.JSeparator;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.SwingUtilities;
    import javax.swing.border.BevelBorder;
    import javax.swing.border.EtchedBorder;
    
    public class GUI extends JFrame {
        private JTextArea jTextArea1 = new JTextArea();
        private JScrollPane jscrollpanel=new JScrollPane();
        private JPanel jPanel1 = new JPanel();
        public JTextField jTextField4 = new JTextField();
        public JTextField jTextField5 = new JTextField();
        private JLabel jLabel4 = new JLabel();
        private JLabel jLabel5 = new JLabel();
        private JLabel jLabel7 = new JLabel();
        private JButton jButton1 = new JButton();
        private Main main=null;
        private ReMain rmain=null; 
        private JButton jButton2 = new JButton();
        private JButton jButton3 = new JButton();
        private JButton jButton4 = new JButton();
        private JButton jButton5 = new JButton();
        private JButton jButton6 = new JButton();
       
    
        public GUI(Main m) {
            main=m;
            try {
                jbInit();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        public void writeTextArea(String txt){
            jTextArea1.setFont(new Font("Verdana",1,9)); 
            jTextArea1.append(txt+"\n");
        }
        private void jbInit() throws Exception {
            ImageIcon image=new ImageIcon("src\\image\\view.png");
            ImageIcon image2=new ImageIcon("src\\image\\close.png");
            ImageIcon image3=new ImageIcon("src\\image\\configure.png");
            this.getContentPane().setLayout( null );
            this.setSize(new Dimension(695, 260));
            this.setTitle("Simulator Messiah - Server");
            
            //jTextArea1.setBounds(new Rectangle(115, 135, 385, 160));
            //jTextArea1.setFont(new Font("SansSerif",3,12));
            jTextArea1.setEditable(false);
            //jTextArea1.setBackground(SystemColor.controlHighlight);
            jPanel1.setBounds(new Rectangle(515, 55, 160, 80));
            jPanel1.setLayout(null);
            jPanel1.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
            jTextField4.setBounds(new Rectangle(30, 15, 120, 15));
            jTextField4.setEditable(false);
            jTextField5.setBounds(new Rectangle(30, 40, 120, 15));
            jTextField5.setEditable(false);
            jLabel4.setText("Lat");
            jLabel4.setBounds(new Rectangle(10, 15, 25, 15));
            jLabel5.setText("Lon");
            jLabel5.setBounds(new Rectangle(10, 40, 25, 15));
            jLabel7.setText("Info");
            jLabel7.setBounds(new Rectangle(125, 35, 34, 15));
            jLabel7.setFont(new Font("Verdana", 0, 11));
        jPanel1.add(jLabel5, null);
        jPanel1.add(jLabel4, null);
        jPanel1.add(jTextField5, null);
        jPanel1.add(jTextField4, null);
        this.getContentPane().add(jButton6, null);
        this.getContentPane().add(jButton5, null);
        this.getContentPane().add(jButton4, null);
        this.getContentPane().add(jButton3, null);
        this.getContentPane().add(jButton2, null);
        this.getContentPane().add(jButton1, null);
        this.getContentPane().add(jLabel7, null);
        this.getContentPane().add(jPanel1, null);
       
        
        
            JScrollPane scrollPane=new JScrollPane(jTextArea1);
        jButton4.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent e)
            {
              jButton4_actionPerformed(e);
            }
          });
        jButton5.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent e)
            {
              jButton5_actionPerformed(e);
            }
          });
        jButton6.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent e)
            {
              jButton6_actionPerformed(e);
            }
          });
        jButton6.setBounds(new Rectangle(575, 165, 100, 20));
        jButton6.setText("Configure");
        jButton6.setIcon(image3);
        jButton3.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent e)
            {
              jButton3_actionPerformed(e);
            }
          });
        jButton5.setBounds(new Rectangle(10, 170, 105, 20));
        jButton5.setText("View Mag");
        jButton5.setIcon(image);
        jButton4.setBounds(new Rectangle(10, 140, 105, 20));
        jButton4.setText("View Sbp");
        jButton4.setIcon(image);
        jButton3.setBounds(new Rectangle(10, 110, 105, 20));
        jButton3.setText("View Mb");
        jButton3.setIcon(image);
        jButton2.setBounds(new Rectangle(10, 80, 105, 20));
        jButton2.setText("View SSS");
        jButton2.setIcon(image);
        jButton1.addActionListener(new ActionListener()
          {
            public void actionPerformed(ActionEvent e)
            {
              jButton1_actionPerformed(e);
            }
          });
        jButton1.setBounds(new Rectangle(575, 195, 100, 20));
        jButton1.setText("Close");
        jButton1.setIcon(image2);
            scrollPane.setBounds(new Rectangle(125, 55, 385, 160));
            scrollPane.setFont(new Font("SansSerif",3,12));
            scrollPane.setBackground(SystemColor.controlHighlight);
             this.getContentPane().add(scrollPane, null);
            this.setResizable(false);
            
        }
    
      private void jButton1_actionPerformed(ActionEvent e)
      {
        main.Stop();
        this.dispose();
      }
    
      private void jButton3_actionPerformed(ActionEvent e)
      {
                   
      }
    
      private void jButton6_actionPerformed(ActionEvent e)
      {
           FileConfig f=new FileConfig();
           
           try{
               f.readProperties();
               Configure c=new Configure(this);
               c.setLocation(270,180);
               c.setText11(f.getPath());
               c.setJText1(String.valueOf(f.getIDShip()));
               
               c.setText12(f.getPort());
              
               c.show();
           }catch(IOException ioe){
               System.err.println(ioe.getMessage());
           }
      }
    
      private void jButton5_actionPerformed(ActionEvent e)
      {
      }
    
      private void jButton4_actionPerformed(ActionEvent e)
      {
        }

    tulipan

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.