ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Sorry, but I not quite understood your question. If you post some code or some more detailed explanation of what you are trying to accomplish I may be able to give you a hand. Don't be ashamed to draw what you want in a paper and post here if you have to
In this example the answer is work and appears as a label but I want to print a The answer is:
before the label answer and after label answer I want to print this word Square
Also I want to print the a title ("square program"); center above the code and in the new line I want to print (" enter a number"); center
OK. That's a little bit more complicated than it looks and if you are going to stick with GUI/Applet programming, it might be a good idea to learn about Layout Managers and how they work:
It’s actually perfect ………and it much better and understandable than my codes ……………………… but I still need the answer of how I can but a comment after and before the answer. Fore ample If I enter number 2 the result should print
The Number is : 4 [this is the answer] %
Cool. I'm glad you liked. It's very hard coded still, but I'm sure you will fix it . To get the label where you want, in one line of code, it would be:
Code:
Panel bottomPanel = new Panel();
bottomPanel.add(new Label("The answer is: "));
bottomPanel.add(lblAnswer);
That part in bold is the line you've to add to the above code ^_^.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.