How do I chance the place of JLabel and JButton in JPanel.

I'm using DefaultLayout and I want to give the user the ability to change the place of JLabel and JButton. I managed the DnD part, but when "dropped" the control returns to it's original position.
I tried using setX() and setY().

You need to use a null Layout, also known as [url http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html]Absolute Positioning

Similar Messages

  • Color of JLabel and JButton text

    Hi,
    Could someone tell me how to set the color of JLabels and JButton text.
    Thanks

    for JButton text
    myButton.setForeground(Color.yellow);
    for JLabel
    myLabel.setForeground(Color.green);

  • How can I change the place of a photo in iPhoto?

    How can I change the place label of a photo in iPhoto?

    http://support.apple.com/kb/PH2381
    LN

  • Hi, how a can chance the email adress to my segurity questions.

    Hi, how a can chance the email adress to my segurity questions.

    Click here for information. If you can't reset it through the method described in that article(it requires correctly answering two of the questions), contact the iTunes Store staff via the link in the 'Additional Information' section. Nobody on these boards can reset your security questions or change your rescue email address.
    (112018)

  • How to print JTextPane containing JTextFields, JLabels and JButtons?

    Hi!
    I want to print a JTextPane that contains components like JTextFields, JLabels and JButtons but I do not know how to do this. I use the print-method that is available for JTextComponent since Java 1.6. My problem is that the text of JTextPane is printed but not the components.
    I wrote this small programm to demonstrate my problem:
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;
    import java.awt.print.PrinterException;
    public class TextPaneTest2 extends JFrame {
         private void insertStringInTextPane(String text,
                   StyledDocument doc) {
              try {
                   doc.insertString(doc.getLength(), text, new SimpleAttributeSet());
              catch (BadLocationException x) {
                   x.printStackTrace();
         private void insertTextFieldInTextPane(String text,
                   JTextPane tp) {
              JTextField tf = new JTextField(text);
              tp.setCaretPosition(tp.getDocument().getLength());
              tp.insertComponent(tf);
         private void insertButtonInTextPane(String text,
                   JTextPane tp) {
              JButton button = new JButton(text) {
                   public Dimension getMaximumSize() {
                        return this.getPreferredSize();
              tp.setCaretPosition(tp.getDocument().getLength());
              tp.insertComponent(button);
         private void insertLabelInTextPane(String text,
                   JTextPane tp) {
              JLabel label = new JLabel(text) {
                   public Dimension getMaximumSize() {
                        return this.getPreferredSize();
              tp.setCaretPosition(tp.getDocument().getLength());
              tp.insertComponent(label);
         public TextPaneTest2() {
              StyledDocument doc = new DefaultStyledDocument();
              StyledDocument printDoc = new DefaultStyledDocument();
              JTextPane tp = new JTextPane(doc);
              JTextPane printTp = new JTextPane(printDoc);
              this.insertStringInTextPane("Text ", doc);
              this.insertStringInTextPane("Text ", printDoc);
              this.insertTextFieldInTextPane("Field", tp);
              this.insertTextFieldInTextPane("Field", printTp);
              this.insertStringInTextPane(" Text ", doc);
              this.insertStringInTextPane(" Text ", printDoc);
              this.insertButtonInTextPane("Button", tp);
              this.insertButtonInTextPane("Button", printTp);
              this.insertStringInTextPane(" Text ", doc);
              this.insertStringInTextPane(" Text ", printDoc);
              this.insertLabelInTextPane("Label", tp);
              this.insertLabelInTextPane("Label", printTp);
              this.insertStringInTextPane(" Text Text", doc);
              this.insertStringInTextPane(" Text Text", printDoc);
              tp.setEditable(false);
              printTp.setEditable(false);
              this.getContentPane().add(tp);
              this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              this.setSize(400,400);
              this.setVisible(true);
              JOptionPane.showMessageDialog(tp, "Start printing");
              try {
                   tp.print();
              } catch (PrinterException e) {
                   e.printStackTrace();
              try {
                   printTp.print();
              } catch (PrinterException e) {
                   e.printStackTrace();
         public static void main(String[] args) {
              new TextPaneTest2();
    }First the components are shown correctly in JTextPane, but when printing is started they vanish. So I created another textPane just for printing. But this does not work either. The components are not printed. Does anybody know how to solve this?
    Thanks!

    I do not know how I should try printComponent. From the API-Doc of JComponent of printComponent: This is invoked during a printing operation. This is implemented to invoke paintComponent on the component. Override this if you wish to add special painting behavior when printing. The method print() in JTextComponent is completely different, it starts the print-job. I do not understand how to try printComponent. It won't start a print-job.

  • HT204053 How do I use the same Apple ID and different Cloud for other devises

    Hi
    How do I use the sane Apple ID and different Icloud for other devises

    http://support.apple.com/kb/HT4627

  • Ever since I updated my iPhone 4S and my iPad 2 to IOS 6 all my iMessages are coming to both my iPhone and my IPad. How do I stop the iMessages I send and receive on my phone from receiving on my iPad as well? I have tried going into my settings and makin

    Ever since I updated my iPhone 4S and my iPad 2 to IOS 6 all my iMessages are coming to both my iPhone and my IPad. How do I stop the iMessages I send and receive on my phone from receiving on my iPad as well? I have tried going into my settings and making sure I'm only set up to receive iMessages to my cell number and not my email....but that didn't fix the problem.

    Here the way to do it, for both, or for only one Go into your settings, Messages and turn on iMessage. It will then send messages that are iMessages to both your iPad and iPhone. You can also turn off this feature on the iPad if you do not want to receive messages on the iPad.

  • IPod Touch 64GB activated October 2013 - how do I get the free iLife, iPhoto and iMovie apps?

    I purchased (from an authorised seller - Dixons Duty Free, Heathrow) and activated an iPod Touch 64GB on 18th October 2013 (prior to the announcement of free iLife, iPhoto and iMovie apps but after the 1st Sepember 2013 date in their conditions). It had iOS6 preinstalled. I've updated to iOS7. How do I get the free iLife, iPhoto and iMovie apps? The App Store is trying to charge me for theese.

    Problem solved from information found in another thread....
    If your iOS device was activated for the first time after September 1, go to the App Storeon your iPod which should open to Featured. If not, tap on Featured at the lower left of the screen & scroll down to Collections & tap on New to the App Store? then scroll down to Apps Made by Apple & tap. You should now see the iWork & iLife apps as "FREE."

  • How do I get the iCloud to save and sync and upload info from both the devices on my account. Right now I can only do one

    How do I get the iCloud to save and sync and upload info from both the devices on my account. Right now I can only do one

    You must put each device on the Verizon cloud.
    Not both lines on one.
    Go and set up a my Verizon account for the second line and you will have Verizon cloud service on that line.
    Oh the term "icloud" is a trademark of Apple Inc. Verizon is not Apple.
    Good Luck

  • How do I change the lable of next and previous button in GAF of FPM

    Hi Experts,
    How do I change the label of next and previous button in GAF application using FPM in each individual step?
    Thanks!

    Hello Anthony,
    as far as I am aware only the final step before the confirmation screen can be changed. Which you can do by clicking on it in the configuration view - click on the last but one step - and click on the next button - at the bottom of the screen you'll get a view where you can change the label of the step.
    There is some logic in this - in that it does make for a more consistent user experience across various apps.
    It's different to how we could do things in Java - but it's nice that there is a certain level of conformity across FPM apps.
    hope this helps,
    Cheers,
    Chris

  • My husband uses adobe cs5. The clone tool isn't working and after resetting the tools adobe bridge now goes to picasa. How can we make the clone tool work and have bridge go to cs5 not picasa?

    My husband uses adobe cs5. The clone tool isn't working and after resetting the tools adobe bridge now goes to picasa. How can we make the clone tool work and have bridge go to cs5 not picasa?

    A lot more information about your hardware and software is needed.
    BOILERPLATE TEXT:
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CC", but something like CC2014.v.2.2) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    a screen shot of your settings or of the image could be very helpful too,
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • How do I use the commands to start and restart the jmqbroker normally?

    How do I use the commands to start and restart the jmqbroker normally?
    Because I have tried to use "jmqcmd shutdown bkr" and then tried to type
    "jmqbroker" to start up. My screen hangs up and seems that the process
    hangs up. The message is
    [28/Jun/2002:18:29:07 GMT+08:00] [B1060]: Loading persistent data...
    [28/Jun/2002:18:29:08 GMT+08:00] [B1039]: Broker "jmqbroker" ready.
    The prompt is hanged until I press CTRL-C.
    Then I got the following message:
    [28/Jun/2002:18:32:07 GMT+08:00] [B1047]: Shutting down broker...
    [28/Jun/2002:18:32:07 GMT+08:00] [B1077]: Broadcast good-bye to all
    connections ....
    [28/Jun/2002:18:32:07 GMT+08:00] [B1078] Flushing good-bye messages
    [28/Jun/2002:18:32:07 GMT+08:00] [B1056] Cleaning up persistent
    store...
    [28/Jun/2002:18:32:07 GMT+08:00] proceessing 0 messages and cleaning
    up 0 files...
    [28/Jun/2002:18:32:07 GMT+08:00] [B1063] Done
    [28/Jun/2002:18:32:07 GMT+08:00] [B1048]: Shutdown of broker complete.
    Then, I use jmqadmin to invoke the console, I can start the broker
    again, it gives me
    Error encountered while connecting to the broker: "MyBroker":
    Broker Host: 'localhost'
    Primary Port: '7676'
    [C4003]: Error occurred on connection creation, - caught
    javax.jms.JMSException
    Please verify that there is a broker running on the specified host and
    port.
    I used ps -def | grep jmq there is no process anymore.
    Is it a bug? Would somebody have any idea on what went wrong?

    'jmqbroker' is the command to start a broker.
    When you type 'jmqbroker' in a command window,
    unless you put it in the background, the shell
    prompt won't return until the broker is shutdown.
    So when you see 'Broker "jmqbroker" ready.', it tells
    you that the broker is running and is ready.
    When you CTRL-C the process, it has the same effect
    as using jmqcmd to shutdown the broker. And so after that,
    there's no jmq processes running since you have just
    shutdown the broker.
    Remember that the jmqcmd/jmqadmin 'restart' command is to
    restart an already running broker. jmcmd/jmqadmin does
    not support starting a new broker instance.
    If you are using csh, end the jmqcmd command with an ampersand ("&")
    to have the broker running in the background. An alternative is to
    stop the process with Ctrl-Z then input the command "bg" to have that
    process resumed in the background.
    The problem with not being able to start a broker using the
    administration console is a documented limitation of the product that
    Yvonne also mentioned. Check the Administrator's Guide for that.

  • In Preview, how do I remove the web address header and foot?

    In Preview, how do I remove the web address header and foot?
    Thank you
    Peter

    If you are referring to the preview of a webpage that you printed then in Safari in the Print dialog box is a tick box labelled 'Print headers and footers', if you untick this then they will not be included in the printout and also not included in the PDF version viewed in Preview.
    PS. You have to have 'show details' enabled in the Print Dialog to see the above option.

  • How Can I have the MB display (1280X800) and a  1440 x 900 ext not in miror

    How Can I have the MB display (1280X800) and a 1440 x 900 ext not in miror mode ???
    I have a Lenovo external display :
    H19-inch (483-mm) viewable image size
    Optimum resolution: 1440 x 900
    Tilt stand for viewing comfort adjustments
    16 x 10 aspect ratio
    Analog attachment

    I just bought a wide screen display that also uses 1440 X900 resolution. In mirror mode mine also only allows a maximum of 1280 X ???. I think may be a limitation of the GMA 950 graphics chip set. I never use it in mirrow mode so it doesn't bother me. I prefer extended mode. That way I can keep more windows open and visible.
    I use the question mars because on mine I can use 1280 X any of the resolutions that go with it.

  • How can I view the text messages sent and received from my phone?how can I view the past text messages sent to my phone

    How can I view the text messages sent and received on one of the other phones on my plan?

    You would have to view them on the other phone.

Maybe you are looking for