Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
|
Java GUI Discussions specific to programming Java GUI.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java GUI section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 14th, 2005, 01:13 PM
Registered User
 
Join Date: Dec 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to insert text into panel with out textarea

In java, I'm using frame in awt package. And, I was wanting to add text to my panel. I want it to be centered and formated in a way that it looks like this:

<center>this is how it is an
and I don't want it anyother way
how do you want it and
it must be a misstake
what you want to know is what you'll find</center>
I tried using label but it ends up showing up side by side when I put it in the north. I don't want to use text area or textfield because it shows these ridiculous boxes round it and I cant really format that either. Could some one help me with this problem?
 
Old January 15th, 2005, 01:34 PM
Registered User
 
Join Date: Dec 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Never Mind, I fixed it. But, I'm glad I didn't hold my breath until someone replied because I'd be a dead programmer other wise.

If anyone want to know how I got it to work or need a clearer explanation of what I was asking, just reply to this section.
 
Old January 15th, 2005, 02:02 PM
Authorized User
 
Join Date: Dec 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sorry for inconvenience. but will you please explain what you want to do with that.and how you managed to get through it.

HumaMunir
 
Old January 17th, 2005, 12:10 AM
Registered User
 
Join Date: Dec 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by HumaMunir
 sorry for inconvenience. but will you please explain what you want to do with that.and how you managed to get through it.

HumaMunir
I wanted to create a java window that displayed text, without using textarea The application that I have made requires that you understand what each button does.

At first I was using the awt package. But after careful research, I've discover that using swing package is far more effective for creating a window and easier to use. One source say that awt is heavy and swing is light, whatever that means. I just know that you can use something called a JEditorPane that allows you to write HTML and in a window so that text shows up natural and fluid.

if there are anymore questions or if someone would like to see an example of my code then just say so...

 
Old January 18th, 2005, 04:36 PM
Authorized User
 
Join Date: Dec 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

well, its a new thing for me. thanks for letting me know.

HumaMunir
 
Old May 6th, 2005, 03:35 PM
Authorized User
 
Join Date: Jul 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to merediths
Default


 Use the Graphics2D objects 'drawString()' method; note that this is basically low-level graphics stuff, you will have to essentially persist what you want redrawn between paint() calls yourself, meaning you need to keep track of what's been drawn, and redraw it evertime the window is repainted, but here you go:

 g2.drawString()

 take a look, there are a couple of overloaded versions that take x,y parameters and such which are the screen coordinates of where you want to draw. Note that it's pretty much one way, there's no equivlant 'readString()' method, because drawString() converts from a string to a raster image.

Regards,
Meredith Shaebanyan






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to insert textarea content into MySQL? a5xo3z1 Beginning PHP 14 October 2nd, 2008 01:47 PM
TEXTarea to text file Apocolypse2005 Javascript 1 January 19th, 2007 05:52 AM
How to text in statusbar panel and blank datagrid sir_cop VB.NET 2002/2003 Basics 2 January 11th, 2007 03:24 PM
Align text in textarea crmpicco HTML Code Clinic 27 June 14th, 2005 08:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.