[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

variable to replace .statement

Posted on 2004-04-23
7
Medium Priority
?
199 Views
Last Modified: 2010-03-31
Hello everyone out there I hope someone can help me with this simple question!

I want to know if I can set up a variable to replace this:   .setHorizontalTextPosition(SwingConstants.LEFT);
                                                                      to this: .variable


jCheckBox1.setHorizontalTextPosition(SwingConstants.LEFT);
0
Comment
Question by:Drop_of_Rain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 92

Expert Comment

by:objects
ID: 10905735
sorry don't understand what u mean
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10905747
there is no such option available in Java.

you are asking like

with (textArea)
{
      .setText("A");
      .setLocation(10,10);
}

This is not available in java and is not pure object oriented then...



Regards,
Muruga
0
 

Author Comment

by:Drop_of_Rain
ID: 10905761
Setting a variable like this so I could type: jCheckBox1.textLeft instead of

jCheckBox1.setHorizontalTextPosition(SwingConstants.LEFT);

I was just curious is all?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 10905779
no u cant do that.

you could create a helper method:

public class Utes
{
   public static textLeft(JCheckBox cb)
   {
      cb.setHorizontalTextPosition(SwingConstants.LEFT);
   }
}

you could then do:

Utes.textLeft(jCheckBox1);
0
 
LVL 92

Expert Comment

by:objects
ID: 10905788
the other option would be subclass JCheckBox:

public class MyCheckBox extends JCheckBox
{
   public void textLeft()
   {
      setHorizontalTextPosition(SwingConstants.LEFT);
   }
}
0
 

Author Comment

by:Drop_of_Rain
ID: 10905794
Thanks that answers the question, I didn't think that could be done I just wanted to know.

Thanks
Christopher
0
 
LVL 92

Expert Comment

by:objects
ID: 10905833
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question