Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  [2 JFrames, one only repaints when being resized..!?] [FIXED]  (Read 161 times)
0 Members and 1 Guest are viewing this topic.
Offline GabrielBailey74

Full Member
**

Posts: 157
Medals: 2


Owner of Elite Demons R.I.P


« on: 2012-02-02 01:10:29 »

So i tried adding a sub JFrame, it's in a private inner class, it has a paint method, super.paint(g);, the only time that it paint is while it's being resized, or everytime it's being opened.

If need be I can explain more, upload pictures, all i'm having it to is repaint Strings.

EDIT: My bad, I made the GUI implement class: SF1, when it should of implemented SF1.SUB so 'super.paint(g)' could loop.

Code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
   public static class SUB extends JPanel {
      public void paint(Graphics g) {
         super.paint(g);
         //p = new Performance();
        final Graphics2D g2d = (Graphics2D) g;
         g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
         g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
         g2d.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
          //getTotalMem(), getFreeMem(), getMemUsed(), getMemUsedPercent()
        GraphicsHandler.renderText(g, "Memory Used: "+Performance.memoryUsed+"mb.", 50, 50, Color.RED, GraphicsHandler.small);
         System.out.println("Painting SUB");
      }
   }


And even though thrown in other loops:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
   private void Cycle() {
      repaint();
      SF1 SUB;
      SUB = new SF1();
      SUB.cycle();
      SUB.sub.repaint();
      updateFps();
   }

      public void cycle() {
         Performance.processMemory();
         repaint();
      }


It still doesn't want to repaint.

Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.078 seconds with 20 queries.