• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Code to restore jPane from minimized down in toolbar?

 
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
.... NO!  both classes do heavy lifting and share data between them. This is a fully operational app and dependent on both main classes.
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mmmmmm .... no!  Both main classes share data/instructions/etc between them. The event listener is listening on the serial com port,on event,parses this data stream,stores it to Derby database and up dates this back out to my jTable. This is a fully functional working app ..... dependent on BOTH main classes to funtion.  
 
Sheriff
Posts: 28371
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, you're not the first person to write applications and find they need to be changed due to new requirements. It sounds like you already have a communication channel from the serial port via the database to the GUI, so maybe you can piggyback on that to find out whatever it was. Or maybe you can build another communication channel.
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
..... Now i'm really lost  :  (

https://www.screencast.com/t/6Rk2qkcEEKJ5
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
..... all I need now is the proper code to bring this GUI back up from its iconified state ..... so the end user can again see the Gui.  I don't know how to assemble a working code structure to do this.
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

From another class, I'm trying to set this currently inconified Frame back to NORMAL.

i'm doing like this, but not working.  Whats the proper way to call this ?   thanks!  

                 
                 




 
Bartender
Posts: 10983
87
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Call

or if you are calling it within a class that extends Frame

Why on earth did you post the entire java.awt.Fame file? Calling setState() happens in your code, not inside the Frame code.
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
.... both give me errors "non-static method setState(int) can not be referenced from a static context"
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont see it!  ......same error no matter what I do  :  (
 
Carey Brown
Bartender
Posts: 10983
87
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carey Brown wrote:Call

or if you are calling it within a class that extends Frame


What you CAN'T do is call

This is the syntax for calling setState() IF setState() was a static method, which it is not.
You have to replace "Frame" with your own Frame reference variable.
If it still doesn't work post the 1-3 lines that are giving you grief.
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The calling class does not extend Frame,  so here is how I'm calling setState:

 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my guess is that the "MainDisplay" GUI class that was generated by the Netbeans IDE has the "setState();" un-accessible to my outside class
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

....... this is the calling class: (Error on line 133)


 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

..... "setExtendedState" .......same error


 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...... if I put "setExtendedState(Frame.NORMAL);" under a test jButton in the MainDisplay class and manually maximized the screen, pressing this test button brings the Frame back to NORMAL just fine.  I just can't get " setExtendedState(Frame.NORMAL);" to work outside of my GUI class (MainDisplay).
 
Carey Brown
Bartender
Posts: 10983
87
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Somewhere in your code you are creating a new instance of MainDisplay like this
Or
The second one gives you a reference variable called "mainDisplay" (or whatever). Use this to invoke setState(), as in

I notice you keep referring to setExtendedState(), how is that different than setState(). I know setState() works but I don't know anything about setExtendedState().
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SetState();  .... is old version  gives you only "NORMAL" and "ICONIFIED"

setExtendedState(); ..... is newer version adds "MAXIMIZED_HORIZ" and "MAXIMIZED_VERT" and "MAXIMIZED_BOTH" as well.
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

.......   No error now! ..... but still NOT taking my manually iconified frame back up to normal  :  (


 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
not working with ....JFrame.NORMAL or Frame.NORMAL or jFrame.NORMAL
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry .... JFrame, jFrame and Frame
 
Carey Brown
Bartender
Posts: 10983
87
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure anymore how to convey this to you. You ALREADY have a MainDisplay reference. Don't create yet another MainDisplay because it won't have any effect on your original instance.

Not counting these incorrect lines
show me the code where you are calling
Come to think of it, I don't see how this compiled
If MainDisplay is a class then you would have needed

 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Netbeans GUI builder must have something to do with this in that I am not calling this up properly  :  (

 
Carey Brown
Bartender
Posts: 10983
87
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rick Liberato wrote:


What is the context of this snippit? Is it inside a method that is inside your MainDisplay class? Let's see the whole MainDisplay class, or at least the whole method.
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

..... I tried that a few hrs back ..... didn't work  :  (


 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"What is the context of this snippit? Is it inside a method that is inside your MainDisplay class? Let's see the whole MainDisplay class, or at least the whole method."

The two main class in this app are "MainDisplay" and "TwoWaySerialComm"   Both have a "main class"  ..... to run this app, you run "MainDisplay" .... that calls "TwoWaySerialComm" to run as well. Both are fully posted on here.
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a working app!  https://www.screencast.com/t/6Rk2qkcEEKJ5

I have a listener already on the serial com port waiting for a string of data.

on event,  I parse and save to derby database then query that data back to my GUI. I also turn on labels on the GUI and post that a 911 call was made and from what phone extension it came from.

The only problem I have is that if this apps window is iconified down in the tool bar at that time (911 call detected) , I can't see the warning message it is showing.  I am simply looking for the code that will deiconify my apps window!  so, I already have a list of things that are carried out "on event"  .... just need to add a way to "show my hidden apps gui"

 
Carey Brown
Bartender
Posts: 10983
87
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is my attempt at a small runnable piece  of code that demonstrates your issue. That being: how to deiconify from another class instance, e.g. External.
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks!   ..... I've run sample code like this before with no problem.  Here the code is making "its own" Frame and acting on it.

The problem I'm having is that the way Netbeans builder creates my GUI, I cant see what code is needed to take the iconified window back to a visible display.

Can you show me a simple example of a Netbeans builder created GUI Frame with an external class calling the GUI back up from the toolbar? (lets say a simple timer firing (external class) a command to de-iconify the GUI)in the GUI's "MainDisplay" class
 
Carey Brown
Bartender
Posts: 10983
87
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you provide a SSCCE to illustrate where you are stuck?

I've tried to illustrate by example how to create an SSCCE but no luck. Read the above link.
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
.... making great progress!! :  )   I have at least 30 code snips that don't work  :  (

These are the only ones that allow me to compile:

            setExtendedState(Frame.NORMAL);      
            setExtendedState(JFrame.NORMAL);    
            setExtendedState(NORMAL);  

Works "in" the GUI builder Frame class  .... but not in my external class where I need it!  :  (
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
.... this may be what I need  , but error says "state is "private"  .... I will need to make that "public" and/or "static"  I would think.  (found in the JDK1.8)   I don't know how to change this in Netbeans GUI builder.  Is it possible to make this change in the Java JDK files itself?

 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
.... after 3 days of trying to do this and getting nowhere, I gave up for now.  I just now added a listener to the "911"label on the GUI that gets turned on in this event, then on label event, I call "setExtendedState(NORMAL);"
works perfect!!  .... all of 3 mins to do  :  (  
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
webpage
 
Rick Liberato
Ranch Hand
Posts: 104
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank-you guys for all your good help!
 
If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic