JSplitPanel--- divider locates at the left(upper) component

I want the divider is located at the right(under) component.
run this program you will see my effect, and fix this problem. thanks for reading
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
public class ChatFrame extends JFrame{
     private JTree tree = null;
     private ClientNode[] clientArray= new ClientNode[9999];
     private JTextArea textChat=null;
     private JTextField [] textBox = new JTextField[9999];
     private Socket connection=null;
     private BufferedReader in = null;
     private PrintWriter out = null;
     private int port;
     private JTabbedPane communicationTab;
     private JButton sendButton;
     public ChatFrame(int port){
          setSize(300,300);
          this.port = port;
          DefaultMutableTreeNode user = new DefaultMutableTreeNode("Another users");
          DefaultMutableTreeNode Client1 = new DefaultMutableTreeNode("Client 1");
          user.add(Client1);
          tree = new JTree(user);
          JScrollPane treeScrollPane = new JScrollPane(tree);
          JPanel p = new JPanel();
          p.add(treeScrollPane);
          communicationTab = new JTabbedPane();
          JSplitPane upperSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,communicationTab,p);
          upperSplitPane.setContinuousLayout(true);
          upperSplitPane.setOneTouchExpandable(true);
          upperSplitPane.setLastDividerLocation(1);
          textChat = new JTextArea();
          textChat.setLineWrap(true);
          textChat.setWrapStyleWord(true);
          JScrollPane scroll = new JScrollPane(textChat);
          JPanel q = new JPanel();
          sendButton = new  JButton("Send");
          sendButton.setSize(2,2);
          q.setLayout(new FlowLayout());          
          q.add(sendButton);
          JPanel tc = new JPanel();
          tc.setLayout(new BorderLayout());
          tc.add(scroll, BorderLayout.CENTER);
          tc.add(q,BorderLayout.EAST);
          JSplitPane underSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,upperSplitPane,tc);
          underSplitPane.setLastDividerLocation(1);
          getContentPane().add(underSplitPane,"Center");
     public void connectToServer(){
          try{
               connection = new Socket("serverName",getPort());
               while(true){
                    in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                    out = new PrintWriter(connection.getOutputStream());
                    String s = in.readLine();
                    if(s!=null){
                         textChat.append(s);
          }catch(Exception e){
     public int getPort(){
          return port;
     public static void main(String[] args){
          ChatFrame c = new ChatFrame(903);
          c.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          c.show();
}

thanks smith...
I have resolved my problem at this evening...
I have just used setResizeWeight(double C);
C value of 0, the default, indicates the right/bottom component gets all the extra space (the left/top component acts fixed), where as a value of 1 specifies the left/top component gets all the extra space (the right/bottom component acts fixed). Specifically, the left/top component gets (weight * diff) extra space and the right/bottom component gets (1 - weight) * diff extra space.
thanks so much.. You make try to fight this project all I have...

Similar Messages

  • Change the icon and the word "open" at the left upper corner of file dialog

    i wanna to change the icon and the word "open" at the left upper corner of a Jfilechooser...
    can any expert tell me how to do so?
    thx and thx...

    yeah u can change the JFileChooser's title by calling the setDialogTitle(String) method. i'm not sure of the icon change, i think it can't be done.

  • My MacBook Pro gets really hot when I open a video file of any kind and the video starts lagging and the image fades away, also with anything that starts the fan. Is extremely hot on the left upper corner. Is there something I can do about it?

    My MacBook Pro gets really hot when I open a video file of any kind and the video starts lagging and the image fades away, also with anything that starts the fan. Is extremely hot on the left upper corner. Is there something I can do about it?

    You are still under warranty.  Call Apple Care. Make sure you get a case number as all repairs have an additional 90 days of warranty. 
    #1 - You have 14 days from the date of purchase to return your computer with no questions asked.
    #2 - You have 90 days of FREE phone tech support.
    #3 - You have the standard one year Apple warranty.
    #4 - If you've purchased an AppleCare Protection Plan, your warranty last for 3 years.   You can obtain AppleCare anytime up to the first year of the purchase of your computer.
    Take FULL advantage of your warranty.  Posting on a message board should be done as a last resort and if you are out of warranty or Apple Care has expired.

  • Unknown icon - yellow envelope LOOK with a "1" located on the left PLEASE HELP!

    there is an ICON that looks like "yellow envelop and there is a letter"1" LOCATED on the LEFT"
    BUT i dont have any unread SMS
    how can I GET RID of it?
    thank you

    If you have email and sms separated, then it's possible to have an unread email that doesn't show up under the sms folder.  Check your "Messages" folder.  Also, when in Messages, hit the menu key and select "View Saved Messages."  Make sure you don't have an unread message in Saved Messages.
    1. Please thank those who help you by clicking the "Like" button at the bottom of the post that helped you.
    2. If your issue has been solved, please resolve it by marking the post "Solution?" which solved it for you!

  • The mouse froze on the left upper corner of the screen

    mouse froze on left upper corner of screen/ sound is gone, sound keys dont work, brightness keys is out too. eject button is variavle
    drive does not reead the osx 10.2.4 installation discs
    i dont know what happened to it, by the way i downloaded 3 gb in 3 cd forms from the net, on the instalation of the 3rd one it did all of that

    First thing to try is to restart.
    As you cant you the mouse or keyboard to shut it down, you need to hold the power button down for several seconds.
    If this dosn't work, if you have and external keyboard try using that if still no luck it might be worth re-installing mac OSX.
    If you still having problems after this then there might be problems with the keyboard, trackpad and possibly your logic board

  • How do I unlock my sim, it shows on my front screen Locked Sim on the left upper corner what does it mean and how do I get rid if it ?

    What does Locked Sim mean? It's on my front upper left corner on
    My other phone? And how did it get locked and how to unlock ?

    Hello Whatever man,
    Welcome to the Apple Support Communities. What you are seeing is that the SIM has a passcode lock that was done by the end user and needs to be unlocked, the following article will assist with the SIM PIN.
    iOS: Understanding the SIM PIN
    http://support.apple.com/kb/HT1316
    Regards,
    -Norm G.

  • HT2486 I can't find how to import contacts from my mail and can't find a contact button in my  mail. when I click on the word contact in the left upper corner like they told me a little box comes up with copyright info but doesn't give me any  info.

    Another question would be if the address book on Macbookair is like a central address book for all emails.

    Hey Janice268,
    Thanks for the question. I understand you wish to add a contact from Mail. The following article outlines how to do so:
    Mail (Mavericks): Add information to Contacts
    http://support.apple.com/kb/PH14928
    In an address field of a message you’re sending or a message you received, move the pointer over an address, click the arrow that appears, then choose Add to Contacts.
    In a message you received, move the pointer over a phone number, email address, or street address anywhere in the text. Mail outlines the information; click the arrow and choose an option from the pop-up menu. For example, add the data to an existing contact.
    Thanks,
    Matt M.

  • My tab for the sites or pages i opened is located on the left side of the screen & its quite difficult for me to see what are pages i've recently opened. its usually on top of the current page, right?

    change of how my tabs for sites are opened

    Do you mean that websites open in the sidebar?
    Opening in the side bar is the default for bookmarks that are created via a link or button on a website.<br />
    You can check the Properties of a bookmark via the right-click context menu in the side bar (Ctrl+B).<br />
    In the Bookmarks Manager (Bookmarks > Organize Bookmarks) you can click the More button in the Details pane at the bottom right.<br />
    Make sure that "Load this bookmark in the side bar" is not selected.<br />

  • Is there a way to set divider location of jSplitPane?

    I am trying to set the divider of my splitpane to have only two locations where the left panel is expaned or contracted.
    I have set the splitpane enable(false); and oneTouchExpandable(true);
    This is how the left panel looks contracted:
    http://hal.humberc.on.ca/~rtsj0002/panel_contracted.jpg
    and this is how the left panel looks expanded:
    http://hal.humberc.on.ca/~rtsj0002/panel_expanded.jpg
    how can i avoid the left panel expanding to this:
    http://hal.humberc.on.ca/~rtsj0002/panelsize_unwanted.jpg
    btw it is being loaded from another class containing the main()
    here is my code:
    http://hal.humberc.on.ca/~rtsj0002/help.java
    thanks for any help

    You should be able to do it. First, the hard wayimport javax.swing.plaf.basic.BasicSplitPaneUI;
    import javax.swing.plaf.basic.BasicSplitPaneDivider;
      BasicSplitPaneDivider divider = ((BasicSplitPaneUI)jSplitPane1.getUI()).getDivider();
        divider.addComponentListener(new java.awt.event.ComponentAdapter() {
          public void componentMoved(ComponentEvent e) {
            // code to move the divider back if isn't where you want it
        });This is going to be hard for two reasons.
    1. You have to figure out where you don't want the divider and once you figure that out, you have to figure out where you want it.
    2. Actually moving the divider will call this method again! Maybe this won't matter if the code for 'is the divider out of bounds' works OK, but it's an issue.
    The easy way.
    setOneTouchExpandable(false);
    Add another button with the symbol '<' or somesuch. When the button is pressed, move the divider to the left and change the symbol to '>'. If the button is hit again, move the divider to the right and change the symbol to '<'

  • How do I get the "playlist" window to open on the left side of the Itunes library

    When I first started using Itunes, the playlist window was located on the left side of the library window. Somehow it got moved to the right side and being a creature of habit, I'd like it back on the left side. I'd also like to know how to lock it so it won't move again. Thanks

    Cntrl + S will enable the sidebar.

  • I have to buttons that I cant remove. The button is on the left side of tabs and on the right side of the tabs. These arent back and forward buttons. When I go to customise they arent shown. How to remove it?

    I have two buttons that I cant remove. The button < is located on the left of the tabs and > is located on the right of the tabs. These aren't back and forward buttons. How can I remove them?
    [https://picasaweb.google.com/dookeybre/DropBox?authkey=Gv1sRgCLyTs7iUlqXE2QE#5594570123175636338 photo of the problem]

    Those buttons are used to scroll through the tabs if you have too many to display. If all of the tabs that you have open are visible, the buttons should not be displayed. If they are displayed all of the time there may be a problem with the theme that you are using.

  • Move the "X" from the left side to the right side in the Document Name Tab

    I just installed CS5 MC for MAC and realized that the "X" to close the file is by default located to the left side of the Document  Name in the Tab or Bar rather than to the right when multiple files are open in an application.  I haven't checked all the Adobe Apps yet, but found this to be the case so far in AI, PS, ID.
    Where do I go in the master or individual app settings to reconfigure the file name/document name tab or bar so the little "X" that closes the file is to the right of the name rather than the left?
    I did notice that in many of Deke's Lynda training videos, the "X" was on the left in a few sessions, but most were on the right.  Really hope this isn't a MAC/PC centric thing or that it is mandatory to download Deke's custom settings for the fix.
    Thanks to anyone with the magic answer!!!
    Cheers!

    Bob --- Thank you for that very quick response.
    Bugger for the unfortunate answer, but thank you for advising/confirming the sad reality.
    Sure wish some code would fall from the sky and do a fix or workaround on this so users have the option.  I may be one of the few hung up on this, but it sure would be nice.
    Seems this is yet another "...centric" reason to use a PC in lieu of a MAC when working with Adobe products these days.
    Flip/Flop go the platforms!
    Cheers!

  • I am creating an I-Web webpage.  When I add pages, the only way to navigate throught the pages is with the menu bar on the left.  How do I navigate to each page on the actual website?

    I am creating a website using i-web.  When I add pages, they appear at the top of the webpage, but I cannot navigate to each page in the navigation bar.  I can only navigate in the menu bar located on the left side of the program.
    How do I navigate thru the website?

    You don't unfortunately, iWeb though great does not allow that funtion.
    If it is a deal breaker for you I would suggest SandVox or RapidWeaver.
    I personal like SandVox
    How ever my website is WordPress, you have to understand a little code, but a lot more freedom
    LearnFromLee
    I may receive some form of compensation, financial or otherwise, from my recommendation or link. <Edited by Host>

  • What is the icon in the toolbar to the left of the Bluetooth icon?th

    There appears to be a new icon in the toolbar on my iPad. It is located to the left of the bluetooth icon. It appears to be a padlock within a clockwise-oriented arrow. Anyone know what this represents? Thx

    Screen Orientation lock you can remove that by using the button next to the volume.

  • Ibook keeps making weird noises on the left side near the fan vent

    Recently my ibook has been making motor noises as it heats up. Sometimes I can make it go away by lifting the front or back up a lottle bit. Last time I got the noise it wouold not stop at all! I tried shutting down and letting it cool way off.....after 2 hours I started again and the noise was there immediately and would not stop. Please help!!

    Hi 744mom,
    Welcome to the Discussions.
    There are 2 things in that area with motors; the fan and the hard drive. With the noise present at a cold start I would think the hard drive might be going bad.
    Launch Disk Utility (in Applications>Utilities) and highlight the drive on the left (upper most in the list). At the bottom of the window you'll see SMART status. Does it say Verified or Failing?
    John

Maybe you are looking for