Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,137 members, 7,818,425 topics. Date: Sunday, 05 May 2024 at 03:12 PM

Some One Should Help Me With This Windowing Issue - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Some One Should Help Me With This Windowing Issue (2543 Views)

Anyone That Know Python Programming Should Help Me To Check The Eorr This / Somebody Should Help Me With Php Function That Generate Barcode(qr CODE) / I Want To Design Javascript Calculator Some One. Should Help. Me With Codes (2) (3) (4)

(1) (2) (Reply) (Go Down)

Some One Should Help Me With This Windowing Issue by Danyl(m): 6:00pm On Aug 16, 2011
hello house, i developed a GUI but i am thinking of inserting this functionality into it such that when i click a button a panel that holds another set of labels textfields and combo boxes will appear under the button and if the button is not clicked the interface remains the way it is.

2. how can retrieve a set of details from an embedded database like H2,sqlite or java derby and print it out through a printer something like a report
just a rough sketch will help. thanks.
Re: Some One Should Help Me With This Windowing Issue by Shimao(m): 7:16pm On Aug 16, 2011
Interface design can be a bother at times. For your first question, you can leave it to a layout manager to do or programmatically adjust the size of the main container. All layout manager resize by default, just make the component in question invisible and have the layout revalidated. But for more precise control, check out the sizing methods. To your second question, printing in java is quite cumbersome. But I think what you need reporting capability and you might like to check out JasperReports for this although othere reporting frameworks exists.
Re: Some One Should Help Me With This Windowing Issue by Danyl(m): 8:43am On Aug 17, 2011
@shimao, do you think resizing the main window can handle this problem cos the major issue to the first question is just that making those components to appear on the same window while they must have been invisible before. is their any control for that or may its just a window listener event stuff i dont know pls check this out.thanks
Re: Some One Should Help Me With This Windowing Issue by Shimao(m): 10:39am On Aug 17, 2011
Add the components you want to toggle their visibility to an intermediate container like a JPanel. Add this JPanel to your main window then set its visibility to false. Call on the pack() method of your top level container. Toggle the visibility of that JPanel in your event listener and invoke the pack() method and your top level container will adjust to display or undisplay your components.
Re: Some One Should Help Me With This Windowing Issue by SayoMarvel(m): 11:49pm On Aug 28, 2011
@poster about the first question, UI issues are not easy to describe with words (screenshots of what you have on ground will help, who knows whether what you need is a tabbed pane?) but I must say that Shimao's solution is very good.
About the second question, you may want to check the Printer Job API if you want precise control over your printer output. That's a little involved though buh lemme give you a back door. Class JTextArea has a method with signature public void print() that pops up a ready made print dialog like that of MS Word, clicking on Print prints out the content of the JTextArea. Since you said you just want to print a rough sketch, you can arrange your report data (I guess its something like Name, Phone, Score, etc) in the text area and invoke print(). If you want better formatting, JEditorPane allows HTML formatting.
There's another approach. You can read the content of your database into a JTable and render the JTable to the printer. Ideally, any JComponent can be rendered to a printer. I hope this helps.
Re: Some One Should Help Me With This Windowing Issue by Danyl(m): 7:45am On Aug 29, 2011
@sayomarvel,thanks alot for this solution, actually the one i did,i used the JToggleButton but its behaving funny, and i think the Tabbed pane style will be okay for the problem. in order to make it simple. am going to send a message to you please kindly reply when you have the time to attend to the issue and i will be very glad to have your response.thank alot
Re: Some One Should Help Me With This Windowing Issue by SayoMarvel(m): 12:31pm On Aug 30, 2011
You're welcome.
Re: Some One Should Help Me With This Windowing Issue by Danyl(m): 2:18pm On Aug 30, 2011
i have installed the java derby software cos the jdk am using is not bundled with the java derby, how can i integrate it into a desktop application.
Re: Some One Should Help Me With This Windowing Issue by Fayimora(m): 8:45pm On Aug 30, 2011
Re: Some One Should Help Me With This Windowing Issue by SayoMarvel(m): 10:35pm On Aug 30, 2011
@Danyl Guy I've downloaded your problem statement and the work you have done so far. Your code is not indented, making it difficult for me to look through it.
I have some questions.
1. Is it a class assignment or something to be paid for? My guess: assignment/fun stuff
2. I saw some questions in the source code, are those the only questions you want to ask? My guess: no, you want to ask so many questions
3. Do you understand the concept of MVC architecture? My guess: no
4. Are you constrained to use card layout? My guess: no
5. Is the application going to be stand-alone (single-user) or client/server (multiple-simultaneous users)? My guess: no

From what I saw in your source code, there is no reason why you will need a tabbed pane (what you need is Next/Previous to traverse questions). Also, there is no need for CardLayout.
Where we use card layout is when we want to hand-build installer dialogs (those Next-Next-Finish screens you see during software installation).
I think what you want to build is a Q & A program (something similar to Who Wants To Be A Millionaire) and I've provided a detailed solution to that problem on this forum. If my guess about your logic is right, your application will have a poor memory utilization (it will have more memory footprint than needed) because you planned to create new GUI components for each question.
Your GUI and business logic are too tightly coupled (they are too aware of each other that you can't change the logic or even the questions without touching the User Interface code). I your source, I saw words like survey and standard surveys are meant to be customizable (using maybe a plain text file) so what I saw is not good enough for production survey code.
If this is not production code and its not client/server, you really don't need a full-blown database. But if you want to learn Apache Derby, try to lay your hands on Apache Derby, Off To The Races.

Let me have your answer to the five questions above. Also, detail the problem statement, stating exactly what you want to accomplish. I can't start designing if I don't have a full understanding of what to design.
Re: Some One Should Help Me With This Windowing Issue by Danyl(m): 11:29am On Aug 31, 2011
@sayomarvel and fayimora i really appreciate your responses many thanks to you once again.
@sayomarvel, as regards to the issue i have sent my reply to your inbox incase you check here before your mail. thanks alot for all
Re: Some One Should Help Me With This Windowing Issue by SayoMarvel(m): 11:27pm On Aug 31, 2011
To make it easy for you to create questions, the first version of this app will use a flat-file database (don't worry we won't be handling raw bytes, it will be character based i.e something you can edit in notepad) properly formatted such that when we're ready to upgrade it to a commercial database, we can use Base to pump the data straight to a MySQL/Derby database. Also, we'll create clear modification points such that upgrading to a commercial database will only require us to re-implement a method or two.
I've started work.
Re: Some One Should Help Me With This Windowing Issue by Danyl(m): 9:16am On Sep 01, 2011
@sayomarvel,thanks n am glad to here that, as regards to the flat file you talked about are u proposing the object serialization sttyle, you talked about. I hope that some day we shall see each other
Re: Some One Should Help Me With This Windowing Issue by SayoMarvel(m): 11:30pm On Sep 01, 2011
I've abandoned the serialization approach because it won't be easy for you to create Questions since it will require some classes that will receive input from the user, create the questions, store the questions in a data structure and then serialize. You will have to run these classes every time you want to create new questions instead of just jumping on Notepad and creating the questions. I've come up with a plain text file with a very simple layout (something you can edit in Notepad). I've also designed the parser for it. I must say however that the ease of a use of a plain-text file comes with a security trade-off (end users can find the file an open it to see all the answers, unless you obfuscate it of course) but don't worry the plain text file database won't be used in the final product. I've been busy doing some other things but I should be through with the back-end tomorrow. Its the API documentation that is slowing me down. Its always good to do your documentation as you code, not after the product is ready.
Re: Some One Should Help Me With This Windowing Issue by Danyl(m): 6:32am On Sep 02, 2011
@sayomarvel, the parser you talked about is it the xml parser or just a document parser.
thanks for taking your time to help on this.
Re: Some One Should Help Me With This Windowing Issue by SayoMarvel(m): 8:55am On Sep 02, 2011
A parser; something that reads a piece of raw data and constructs a valuable information from it. When I designed the layout of the file, I designed a class that will read the entire file picking raw pieces of data and assembling them together (ignoring comments and malformed data); something similar to what a compiler does -- reads a source file, picks out program elements like keywords, operators, operands, etc and use these to create an executable.
In cases of malformed data, the parser for our plain-text database will log a warning message, showing the line where the error occured, making it easy for you to make corrections.
Re: Some One Should Help Me With This Windowing Issue by Danyl(m): 1:26pm On Sep 02, 2011
that is interesting, i think you must have done much of java architecture development, correct me if iam wrong, and if i may ask, are u into java development modules i mean java developers modules (SCJD stuffs), or web component modules/business component modules. am no way near server/socket programming or i/o programming.
Re: Some One Should Help Me With This Windowing Issue by Danyl(m): 2:04pm On Sep 02, 2011
@fayimora, the aApptest file i got from the github link u posted, it produce an exception ClassNotFoundException:org.aparche.derby.jdbc.EmbeddedDriver.
what could be done to rectify the situation, the jdk6.0 am using has java derby bundled with it, i copy the link of the directory to my classpath, recompile and it produces the same error when i run the program.
Re: Some One Should Help Me With This Windowing Issue by Fayimora(m): 4:00am On Sep 03, 2011
Works fine for me! You should know that a ClassNotFoundException cannot possibly be from me, well at least there i a 98% possibility that its from you!That error is a tricky one so you gott be careful! Check the filename and class name for starters. . . since we are using derby te next possible thing i coud think of is if you have added derby.jar or whatever you call it to your classpath. . .

See if any of those help!
Re: Some One Should Help Me With This Windowing Issue by SayoMarvel(m): 1:33pm On Sep 03, 2011
@Danyl Those things are not difficult if you pay attention to them (and you have a strong obsession for programming, of course). Basic networking in Java is just like normal File I/O. RMI even makes life easier. As regards my programming ability, I'm still a small boy o, seriously.
I'm done with the back-end. I'm currently testing it. I'm looking forward to a situation where this application can be used for a multi-user contest (class quiz or something, we can even have mobile phone clients, who knows?). Having that in mind, I want to make it a simple client/server stuff. Since you want a stand-alone app, both the client and server will be on the same machine and the client will connect to localhost. This will make life easier for you when you want to make future enhancements. Ideally, networking should be bypassed for stand-alone applications but I want to keep this thing pretty simple because of my tight schedule.
Re: Some One Should Help Me With This Windowing Issue by Danyl(m): 8:54pm On Sep 03, 2011
@sayomarvel,u incited my mind wit dos word honestly,i really neva think abt a phone client bt i knw alot can stil b achieved wit dt stuff. In regards 2d phone client,aw does a mobile device access d software witout connectn thru a site? except if d mobile version of d application is designed. What back end did u integrate into d program? might say u r smal boy in programming bt its not. I still av a lot 2learn though am learnin day-by-day bt due 2 my workn schedule doesnt gv me time to program.i have dos buks bt time is one of my constraint bt am learning much abt life n programming has a very bright future.
Re: Some One Should Help Me With This Windowing Issue by SayoMarvel(m): 10:16pm On Sep 03, 2011
Back-end/Front-end are not special things (just computer jargon). Back-end (data), front-end (user interface to the back-end). Errrm. . . about the mobile clients, I never really thought that out but if that will happen, then our server code must be running on a computer with a publicly accessible IP address (it means it has to be hosted of course, but it has to be seriously tooshed before it will be okay for such usage.)
Re: Some One Should Help Me With This Windowing Issue by Danyl(m): 6:20pm On Sep 04, 2011
@sayomarvel, thanks for that bit, as for that bit of information, as for the back end did you test it as you said, though the one i uploaded to you, it has a sluggish performance but its quite effective when used on systems with large memory size. more over for the front end, i thnk if a logic for selecting which subject to practice on quizes on could be integrated and listed so that the the interface will just load the subject based on the flat file back end and produce the questions to the interface for the user to start the quiz, i just thought this out so it can add more meaning to the program or what do you think.
Re: Some One Should Help Me With This Windowing Issue by SayoMarvel(m): 11:56pm On Sep 04, 2011
I had already foreseen and integrated that feature. I incorporated category into the questions. Actually, I'm thinking of a fat client (where the client fetches a pool of questions from the database then its up to the client to filter the pool for questions of a particular category). I also incorporated a couple of other things like difficulty and time constraint for each question. This will enable fat clients to do things like set_test_difficulty_level, override per-question time constraint with an overall test time constraint., do the GRE kind of test (where users start with easy questions and the difficulty increases), random questions (category and difficulty), time attack, etc. All these things will not be done from server-side as I said, they're up to the clients. Also I included support for questions with multiple answers (similar to SCJP questions).
I want you to see the plain-text data file as a form of script to easily create questions on-the-fly.
Re: Some One Should Help Me With This Windowing Issue by Danyl(m): 6:40am On Sep 05, 2011
This is becoming interesting,as for d datafile,is there any constraint on the editing of it due 2 difficulty level n users' choice of subject part integrated on d client side though i think it depends on formatting of d datafile,i once thought of using an xml data file formatting but due to the bottle-neck i experienced, i had 2 hold on till i have d parsers(Xerces & XOM/SAX) implementation i editted d classpath env. Variable,bt d system is not picking up d changes bt i hd 2save it for another day so i can update myself dn come @it again.
Re: Some One Should Help Me With This Windowing Issue by SayoMarvel(m): 6:22pm On Sep 05, 2011
Yeah, you'll set difficulty level and catgory for each question directly in the data file.
Re: Some One Should Help Me With This Windowing Issue by Danyl(m): 5:16pm On Sep 06, 2011
in regards to the question u asked yesterday concerning the GUI, actually the client is one and the back end is another thing but the one i sent to you i mean the one i designed with the cardlayout is the one i wanted to handle the front-end and incorporate the logic directly into the front end but it seems the client is going to be too thick, and may be slow in its operations due to the redrawing of the GUI at every clicking of "next" or "previous", i ve tried to implement the design on the netbeans but its some how difficult to implement if one doesnt understand the basics of java cos that netbeans is another platform on its own. if the client logic has to change then the back-end will also change, as regards to the answers u profer then concerning this same Q & A issue, the object serialization and the MVC model which some one told me to use, the learning curve of those logics is quite steep and implementing them will usually provide different exceptions that is why i had to drop it and get more info on networking and jdbc.
Re: Some One Should Help Me With This Windowing Issue by SayoMarvel(m): 11:30am On Sep 07, 2011
I'm through with the database and networking code. I've started work on the GUI (created a couple of configuration dialogs yesterday, you won't like to be starting your app from the command-prompt, would you?) When I'm done with those ones, I'll do the main window and package the whole thing.
Re: Some One Should Help Me With This Windowing Issue by Danyl(m): 5:25pm On Sep 07, 2011
@sayomarvel,tanx alot,actually i av a jar-exe file converter nd installer creator if i av all d class files, but all the same i can still learn frm ur angle of doing things,u really inspired me more on programming.
Re: Some One Should Help Me With This Windowing Issue by SayoMarvel(m): 8:52pm On Sep 07, 2011
Oh dat's great. wich one? Email it to me. Native compilers are also available for Linux. You can get them from the Software Center on Ubuntu.
Re: Some One Should Help Me With This Windowing Issue by Danyl(m): 9:59am On Sep 08, 2011
@sayomarvel,i'll mail u when am online. N i'll also note d native compilers u talked about,who knows it might be better than d one am using.
Re: Some One Should Help Me With This Windowing Issue by SayoMarvel(m): 12:37am On Sep 10, 2011
Still on the job. I noticed a little security flaw in the initial design so I made a few changes (reverting from the initial fat client approach to thin clients, using lazy initialization on the server side to save resources e.g if I were to go with the original plan, with a pool of 1000 questions, if I have 1000 clients connected, the server app will eat up an extra of more than 300mb on the RAM). I had to do some tweaking.Still on the job. I noticed a little security flaw in the initial design so I made a few changes (reverting from the initial fat client approach to thin clients, using lazy initialization on the server side to save resources e.g if I were to go with the original plan, with a pool of 1000 questions, if I have 1000 clients connected, the server app will eat up an extra of more than 300mb on the RAM). I had to do some tweaking.

(1) (2) (Reply)

Yii2 Rest API Question / How To Create A Simple Calculator (using Javascript ) / 30 Things You Should Not Say To A Developer

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 62
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.