Setting location of components

I am new to Java and have learned a little about the setLocation() function. However, this only allows me to set my location after an event trigger. is there a way that I can use this or some other function to set the location of my components at the start of the application.
I am using a flow layout manager:
getContentPane().setLayout(new FlowLayout(FlowLayout.LEFT));
but this still seems to not give me the type of control I would like. I would like to specify the exact location of the components if this is possible.
Any help will be appreciated.
Thanks for your time.

You could use a null layout manager and do it yourself, but I don't recommend this.
What you want is power, full control, domination of your layout manager, I can see your a man who knows where your going. What you need is the awesome, one of a kind, GridBagLayout. It is hard to understand at first, but it works just as you need.

Similar Messages

  • Set location of components and reduce the size

    I want to resize JavaFX component and shrink the components which are next to it. Here is the result which I get:
    When I click on the angle of this component I can resize it down and right.
    http://i.stack.imgur.com/jqoNW.png
    The components which are next to it are pushed down and right. Part of them are behind the visible part of the screen.
    http://i.stack.imgur.com/rsi0L.png
    All components are placed in BorderPane,VBox,HBoxand againBorderPane. I don't want to allow components to move. I want to shrink them and use Scrollpane` when their size is reduced. Can you give me some hits how to solve these two problems?
    Ref javafx 2 - Set location of components and reduce the size - Stack Overflow

    I did something similar the other day. Based on the resizing of the scene I adjusted the position.
    widthProperty().addListener(new ChangeListener<Number>() {
        @Override public void changed(ObservableValue<? extends Number> observableValue, Number oldSceneWidth, Number newSceneWidth) {
            widthChange((Double)oldSceneWidth, (Double)newSceneWidth);
    heightProperty().addListener(new ChangeListener<Number>() {
        @Override public void changed(ObservableValue<? extends Number> observableValue, Number oldSceneHeight, Number newSceneHeight) {
            heightChange((Double)oldSceneHeight, (Double)newSceneHeight);
    You should be able to do something similar, when you add a change listener to your component and handle the resizing of the other components.
    What I don't understand is why you would need a scrollbar, when the components shrink down. I would think it would be the other way round.

  • Setting location of Components within Frame

    Is it possible to set the location of a component, say a Button, within a regular Frame? Or can this only be done within panels?
    public class Help extends Frame {
          Button b1 = new Button("1");
          public Help() {
             setLayout(null);
             setSize(400,400);
             b1.setLocation(10,40);
             add(b1);
             setVisible(true);
    }this always sets the button at the default location.

    Hi, I suppose you should use b1.setBounds() rather than setLocation()
    Regards,
    /Michael

  • Logic plug in setting locations?

    Hi, I'm still kind of new to Mac's and a few weeks ago I was cleaning up and re-orginizing some of my folders. I wasn't aware that mac's are much, more folder specific than a windows OS?  While moving various files/folders when cleaning/orginaizing, I must have moved some of my 3rd party logic folders?  I didn't move any of the actual au componnets they are still in the correct place so that logic can locate them.  Only problem now they can't seem to locate them even though the components show in the correct component folder?  Did I mess something up by moving folders around?  I had assumed as long as I didn't mess with things like the actual component and preset folders that it didn't really matter if I moved I guess what you would call the plugins' main root folder, if that sounds right? 
    Appart from probably having to trash everything and re-install is there anything I can do?  Perhaps a quick fix like ,"just drag/move all my 3rd party plug ins to such and such folder?  I don't understand why in a mac that you can't just create a new folder and  call it, "logic plug in related files"  for example;  and move all of your 3rd party plug ins over to it(except for the actual commponents of course)?  Or can you?  I guess I'm just generaly copnfused about plug in setting locations for both 3rd party and non.  Am I correct in saying that plug in setting location folders can actualy vary from 3rd party to 3rd party plug ins? If this is true what a pain! Like I said I probably have no other option except to delete and re-install?  I wish my mac could be brought back to how it was before I messed with any folders!  Trouble is to free up hard drive space I got rid of a bunch of time machine backup so I don't think I can go back to a previous state before I moved any stuff around:(
    I just don't get it though and its very annoying.  For example, I have a lexicon reverb bundle, always worked great;the correct components are still in the correct audio/plug in/commponent folder, but ever since I moved some root plug in files around the lexicon plug ins no longer show up.   They don't even show in the AU manager,which is frustrating becasue I can go to the component folder and they are physicaly there!  Why would it not even show in the AU manager if the component is physicaly in the right place still?Help please...Wha did I do/What do I do?
    Thanks everybpody,
    Mike

    A line across a plugin usually comes from trying to insert a mono plugin on a stereo track of vice versa. Could this be your problem.
    I've rearranged my project folders many times without any problem whatsoever. Have you saved your projects with Assets?
    R

  • Get Siri to set location reminders (using multiple reminder lists)

    I found a way to get Siri to set location reminders using multiple reminder lists (but you can just use one list too):
    First make additional lists in the reminder app: click list button (the lines on the left) > edit > create new list > done. Make as many as you want. I have grocery, home, personal, business, family.
    Let's say you want a reminder to pick up apples when you get to the apple store. You must add the location in your contacts to your name in contacts.
    Do the following:
    In maps app find the location with search.
    Tap the blue arrow > Add to contacts > Add to existing contact
    Choose your name in contacts. It will be added under your address for home or work so you will need to edit it:
    Click Edit.
    Click on the small label on the left of the new address - it will just say "address"
    Scroll to bottom of page and click on Create custom label
    Enter the location name like "Apple Store". Click Done.
    Important Note: You will need to delete the url it adds under your home url section and maybe other things it messes up with the new contact info instead of yours - so check all the fields each time you do this.
    To make a location based reminder using a specific list you must open that list yourself - Siri will not open it for you.
    Example:
    Open grocery list yourself in the reminders app
    Tell Siri something like: "remind me to pick up apples" (Do not mention the location yet - if you do it will not work)
    Siri will ask: "When should I remind you?"
    Say: "When I get to the apple store"
    Siri will say she will remind you and you will see the location reminder in the grocery list.
    This is how it works for me but if you know an easier way let me know! This is beta so I'm sure it will get easier.

    I have one thing to add.  You don't have to open the list manually.  Tell Siri:  "Add to my <listname> list".  For example, if you have a list named "Work", tell Siri:  "Add to my work list".  Siri will reply, "What should I add to your 'Personal' list?
    and you can continue from there. 
    There is a syntax for doing all this in one sentence, but I find it only works about half the time. Too many fields for Siri to parse in her current Beta stage
    /d

  • Set Location of individual text box - report design

    Post Author: sonjeeva
    CA Forum: Crystal Reports
    Hi Guys,
    Is it possible to set location of an individaul text box to be at the end of report? I know if I have this at end of report area it would work. But my report has a sub report in end of report area and the text box doesn't appear at the end of both reports.
    Cheers
    Sonny

    Post Author: kcheeb
    CA Forum: Crystal Reports
    If you are creating the report through code (C#, VB etc.) you could get the location/size of the subreport and then set the text box location based on those parameters.
    I don't think it's possible from within the Crystal report designer itself. At least I couldn't find a place to do this.

  • Set location  - CR 8.5 vs CR XI

    I didn't find exact answer to my question.
    Short overview. CR layouts are used in ERP system just reading and formating data from SQL 2005 prepared by special stored procedures. Main clue is to use the same layout for production and test databases (with many different names).
    After link new table in CR 8.5 there was only a need to change 'Set location' -> 'Location: Table' from <database name>.dbo.<table name> to <table name> and it works fine.
    Now I'm switching CR layouts to CR XI R1 SP4 (the newest one supported by ERP) but can't find the same possibility like described for 8.5. All new tables based on OLE DB have 'catalog: <database name>' which I cant change. Even if 'Initial catalog' is empty there is always database name in table properties which causes building queries like 'select ... from <database name>.dbo.<table name>' instead of <select ... from <table name>'.
    How to enable behavior known from 8.5 in XI?

    Solution:
    Entering manually table name in 'Overridden Qualified Table Name' without database name solves the problem.

  • Setting locations with your iPhone 4s

    I am pained to admit this, but I cannot figure out how to set locations in my iphone4s that I can set reminders to alert me to do whatever task I had previously set for myself to accomplish when I arrive at the noted location. What types of steps and preferences do I need to select and apply so I can hear Siri tell me as I pull into a lot or walk into a store at one place or another to be reminder of the "note to self" I created earlier to help ensure the purchase of specific goods or anything for that matter! Thanks for helping me out with the awesome function available on my phone that has done nothing but mock my ridiculous inability to master the ins &amp; outs of the program.

    Make sure you have an entry in your contacts for yourself that includes your work address. Then, go to Settings>General>Siri and make sure that your contact is selected for "My Info". For other locations, make sure that there is a contact with the correct address.

  • How do you set location based reminders with location restrictions turned on?

    I can set location based reminders with location restrictions turned off, but I want them on. Otherwise if I lost or if somebody stole my iPhone they could just turn off the find my iPhone function. Yet if I have location services restricted to prevent this then location based reminders are unavailable. Any help would be appreciated

    I can set location based reminders with location restrictions turned off, but I want them on. Otherwise if I lost or if somebody stole my iPhone they could just turn off the find my iPhone function. Yet if I have location services restricted to prevent this then location based reminders are unavailable. Any help would be appreciated

  • How set location for tooltip text ??

    hi ,
    i want to set tooltip location myself to a button . for this i override methods are
    1. public String getToolTipText(MouseEvent e)2 public Point getToolTipLocation(MouseEvent e)here is code... where i have to change to set location for tooltip
    * DebugGraphicsTest.java
    * Created on April 28, 2005, 1:14 AM
    package swingtest;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    * @author  Paramasivam
    public class DebugGraphicsTest extends javax.swing.JFrame {
        public DebugGraphicsTest() {
            initComponents();
            MyButton  btn = new MyButton("Chem m e");
            btn.setToolTipText("this is actual");
            getContentPane().add(btn);
            jButton1.setToolTipText("button 1");
            jButton2.setToolTipText("button 2");
            jButton3.setToolTipText("button 3");
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            jPanel1 = new javax.swing.JPanel();
            jButton1 = new javax.swing.JButton();
            jButton2 = new javax.swing.JButton();
            jButton3 = new javax.swing.JButton();
            getContentPane().setLayout(new java.awt.FlowLayout());
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jButton1.setText("jButton1");
            jPanel1.add(jButton1);
            jButton2.setText("jButton2");
            jPanel1.add(jButton2);
            jButton3.setText("jButton3");
            jPanel1.add(jButton3);
            getContentPane().add(jPanel1);
            pack();
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new DebugGraphicsTest().setVisible(true);
        // Variables declaration - do not modify
        private javax.swing.JButton jButton1;
        private javax.swing.JButton jButton2;
        private javax.swing.JButton jButton3;
        private javax.swing.JPanel jPanel1;
        // End of variables declaration
    class MyButton  extends JButton{
        public MyButton(String s){
            super(s);
        public Point getToolTipLocation(MouseEvent evnt){
            return new Point(100,300);
        public String getToolTipText(){
            return "hihi";
        public String getToolTipText(MouseEvent me){
            return "event hihi";
    }

    Adding the line ToolTipManager.sharedInstance().registerComponent(this); to MyButton's constructor seems to solve the problem.

  • Set location in runtime..

    Hi
    usually i used to save file like this
    String retreive = textarea.getText();
              RandomAccessFile logfile = new RandomAccessFile("c:\\saved.txt","rw");
              logfile.writeBytes(retreive);
              JOptionPane.showMessageDialog(null,"Saved ..","Saved...",JOptionPane.WARNING_MESSAGE);
              catch(IOException e)
              System.out.println("cannot write on to log file....");
              }But it works correctly , i set location inside that and it will save file as i set the location..
    How can i save and decide where to save the file at runtime...
    i mean when i press save button i want to select the drives and save it to the folder as i wish...
    is there any suitable solution.???

    Use a JFileDialog to get the location from the user and use that instead of hardcoding c:\\saved.txt.

  • AutoScrolling of PanelLayout and setting Location of dynamically created controls

    Hi, I have a question related to setting Location of dynamically created controls when my PanelLayout is scrolled down or up.
    So basically I have wrote a code that lets me drag on control over other other and replace their's locations.
    So I wanted to add possibility for user to dynamically add new controls (every new control is suppose to be 200px below previous) - everything is fine as long as I add them from upper section of my LayoutPanel (without scrolling) but when I try to add
    them while I'm half dawn scrolled they are placed based on CURRENT left upper corner which is NOT a upper left corner of LayoutPanel therfore they are placed with wrong padding based on current scrolled position.
    So my question is how can I avoid it and always add new controls based on LayoutPanel upper left corner? (I have already tried disabling AutoScroll while adding new control and enabling it back after adding - it works but I want to find PROPER way because
    I'm sure there must be some kind of solution to it)
    Thanks in advance.

    Hi darekg11,
    >> I have a question related to setting Location of dynamically created controls when my PanelLayout is scrolled down or up
    I am wondering what the PanelLayout was, was it a “flowLayoutPanel” or “tableLayoutPanel”?
    >> basically I have wrote a code that lets me drag on control over other other and replace their's locations
    Did you mean you drag the control at runtime or at design time?
    >> how can I avoid it and always add new controls based on LayoutPanel upper left corner
    I could not reproduce your issue, and could you share us some key code or a simple demo to reproduce your issue?
    I made a research about “scrolling panel”, and I think the link below might be useful to you:
    # Scrolling Panel
    http://www.codeproject.com/Articles/226381/Scrolling-Panel
    Best Regards,
    Edward
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

  • Set location of component in a container

    I'm looking for a way to exactly specify the location for a component in a container.
    For example let's say i have some JPanel and i want to add a JButton to it at coordinates x=100, y=50.
    Is this even possible?
    All the lay out managers seem to prevent this because they auto-arrange the components in the container.

    You can try to use something like this:
    import java.awt.Container;
    import java.awt.Insets;
    import java.awt.Dimension;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    public class AbsoluteLayoutDemo {
        public static void addComponentsToPane(Container pane) {
            pane.setLayout(null);
            JButton b1 = new JButton("one");
            JButton b2 = new JButton("two");
            JButton b3 = new JButton("three");
            pane.add(b1);
            pane.add(b2);
            pane.add(b3);
            Insets insets = pane.getInsets();
            Dimension size = b1.getPreferredSize();
            b1.setBounds(25 + insets.left, 5 + insets.top,
                         size.width, size.height);
            size = b2.getPreferredSize();
            b2.setBounds(55 + insets.left, 40 + insets.top,
                         size.width, size.height);
            size = b3.getPreferredSize();
            b3.setBounds(150 + insets.left, 15 + insets.top,
                         size.width + 50, size.height + 20);
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("AbsoluteLayoutDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Set up the content pane.
            addComponentsToPane(frame.getContentPane());
            //Size and display the window.
            Insets insets = frame.getInsets();
            frame.setSize(300 + insets.left + insets.right,
                          125 + insets.top + insets.bottom);
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }pane.setLayout(null) will give you what you want.

  • Issue Storage Location in Components details Subcontracting PO

    Hi all
    I need to implement this process in SAP:
    I have to send material X, from storage location B 'broken', to my supplier for repairing. After He has repaired it I post good recipe of material X in the storage location A 'adjusted'.
    I plan material X through MRP at plant level only for storage location A.
    In the material master I've set procurement type 'F' and Special Procurement '30'.
    I created a recursive BOM for material X where I entered, for component X, B as issue storage location.
    In this way MRP run (with '1' as value of 'Create PR' parameter) creates subcontracting PR with X as material to buy and X as component to send to vendor, but in the detail of component I have the storage location field kept empty.
    This for me is a problem.
    In fact when I create PO from this PR automatically through ME59 transaction, the System creates a requirement at plant level for component X.
    But this requirement is for broken material and has to be covered by stock in storage location B.
    I know that is not easy to understand all the details of this process, even due to my english, but I hope someone can help my.
    Please if you need a clear up, ask me.
    Thanks for your help
    Yours faithfully
    Paolo Verderio

    Hi Paolo,
    don't worry. Your explanation is well understandable.
    I cannot advise how to fix the problem with the missing storage location. I just have some doubts that it is the right approach to distinguish between an boken and a repaired material by storage location. Even for stock valuation there is certainly a difference between both, that you can't make transparent by storage location, and also if you look at your available stocks.
    I would recommend to have either different materials or different valuation types. I have to confess that I am not sure that valuation types would help for your subcontracting PO.
    best regards,
                     Udo

  • How to set up logical components for ChaRM?

    Hi,
    we do have the following system landscape. One DEV and two separate QA and PROD systems.
    DEV->
    >QA1  -> PROD1
    >QA2  -> PROD2
    For these we want to transport parallel from DEV to QA1/QA2 and then parallel to PROD1/PROD2 via ChaRM.
    My questions are:
    1) Do I have to set up one or two logical components?
    2) How do I have to set up the logical component exactly?
    Thanks.
    Regards,
    Alex
    Edited by: Alexander Barth on Jul 20, 2009 4:02 PM
    Layout changed
    Edited by: Alexander Barth on Jul 20, 2009 4:03 PM

    Hi,
    Chk the below link .
    https://websmp202.sap-ag.de/~sapdownload/011000358700000657692007E/ECTS_CHARM_SP12.PDF
    Thx,
    Waseem.

Maybe you are looking for

  • After upgrading from acrobat 9.5 to XI pro my users have complained on slow typing when filling in form that were created in version 9.5?

    After upgrading from acrobat 9.5 to XI pro my users have complained on slow typing when filling in form that were created in version 9.5? The issue is they type but there is 2 second delay when it appears in the field. Windows 7 64bit

  • ParseException Content-Disposition filename spaces

    Hello All, I have an email generated from Thunderbird 1.5.0.9 (Windows/20061207) which contains an attachment whose filename has spaces. JavaMail (1.4) throws a javax.mail.internet.ParseException on the MimeBodyPart.getDisposition() call: javax.mail.

  • AirPort Express Cannot Join Network

    Hello all, I've tried searching and can't find this exact issue; please forgive me it's a dup. I just purchased an AirPort Express to use with several Windows XP machines for AirTunes and printer sharing. I already have wifi set up using a 2Wire 270H

  • Ideas for the ipod

    i was thinking that it would be cool to have a ipod that i could sit in class and wirelessly play a game with a friend and listen to my music. plus have a wireless docking port so the ipod is almost like a palm pilot with out the memos and buttons. l

  • Retirement of SQL Azure Federations

    I've built my start-up on top of Federations, in part because it was Microsoft's best practice. Now, they are going away, and I feel completely screwed over. I have a few questions. 1. Is it true that all Federations are going away in 1 year, or is t