Setting the Divider in JSplitPanes

Hi
My problem is this... when I create my first internal frame the divider that splits the panes is set in the correct position, however for every internal frame that is created after this one the divider is not in the correct position.
I create the JSplitPane and set the divider in the constructor method of my internal frame class. Here's the code I used:
JSplitPane sPane = new JSplitPane(....);
sPane.addComponentListener(new ComponentAdapter()
public void componentResized(ComponentEvent c)
sPane.setDividerLocation(0.5);
Can anyone help me out as to why this only works first time round?
Thanks
Janie

Try to use another method
public void setDividerLocation(int�location)
location - an int specifying a UI-specific value (typically a pixel count)
regards
Stas

Similar Messages

  • Placing a divider in JSplitPane that can't be resized

    Hi, how can i place a divider in JSplitPane that can't be resized? Or is there another way like JPanels?

    set the divider where you want, then disable the splitpane
    splitpane.setResizeWeight(.25);
    splitpane.setEnabled(false);

  • Setting the counter output mastertimebase divider?

    Hello
    I want to output single short pulses with varying pauses. My MuFu DAQ card has 20 MHz master clock rate and 24 bit counter (Good ol'6052E). When I try to output 1 µs with a pause duration of more than 839 ms, I get an error due to mismatch of clockrate and counter bit size with short and long duration. This is explained in great detail in the corresponding help:
    2/ counter clock rate <= X <= 2^24 / counter clock rate. with counter clock rate = master clock rate / divider
    0.1 µs               <= X     <=   16777215 / 20Mhz = 839 ms
    I could strech my limits by manually setting the CO.CounterTimebaseMasterTimebaseDivider to 10. But I've searched all property nodes I could find but I have not found this property.
    Does anyone know where it is hidden, and to which values it can be set?
    Thank you
    Michael

    Hi Michael,
    Unfortunately that property doesn't exist.  There are a few "Divisor" properties available for other subsystems (e.g. see Analog Input timing block diagram below).
    However, you'll notice in the above diagram that the valid divisors of the master timebase are only 1 or 200 (which then gives the AI Sample Clock Timebase).  You can get similar behavior on the counter by specifying to use the 20 MHz timebase or 100 kHz timebase for your source.  However, using the 100 kHz (1/10 us) timebase is going to prevent you from properly generating the narrow 1 us pulses that you require.
    So, you can use 20 MHz or 100 kHz without any additional resources, but 100 kHz wouldn't allow you to have a 1 us pulse, and 20 MHz won't let you have a high or low time of greater than ~839 ms.  You could generate frequencies in between these to use as the counter timebase (either use the frequency output or use the second counter to generate the desired frequency, or perhaps configure a dummy analog task) but of course there would always be a tradeoff between the resolution of the pulse and the maximum time between pulses.
    If you do have the 2nd counter available, here is my suggestion to get the best of both worlds:
    1.  Configure a counter output to generate a pulse every N seconds (I suggest configuring the output to generate at 1/N frequency at 50% duty cycle).  When you configure this counter, DAQmx will choose an appropriate timebase for you.  When N is less than ~1.67 seconds, DAQmx will use the 20 MHz timebase (since both the high and low time would be under the 839 ms).  When N is > 1.67 seconds but below ~335 seconds, DAQmx will use the 100 kHz timebase.  If you intend on modifying the rate of the output (to something above 1.67 seconds) after the task has started you would need to make sure to specify to use the 100 kHz timebase rather than relying on the DAQmx default.  You can't use a built-in timebase if you want to generate a delay greater than 335 seconds, but if you wanted to you could handle this case by checking for it and configuring the frequency output to generate an even lower timebase.
    2.  To generate the actual output signal, configure a retriggerable single pulse generation to be triggered off of the signal generated above.  This signal will be based off of the 20 MHz timebase (assuming you configure a pulse width less than ~839 ms) and so will give you a good resolution on the available pulse widths that you can generate.
    In summary, doing this would let you decouple the resolution of your generated pulse width from the resolution of the delay between the pulses.  The downside is that it uses two counters.
    The other option which I previously mentioned (and what you were asking about) would be to find a timebase that meets the two requirements: 1) fast enough to generate a narrow pulse and 2) slow enough to not roll-over between pulses.  You have 100 kHz and 20 MHz available to you, but you can generate intermediate frequencies using the frequency output.  If you plan on using a counter to generate the timebase instead, you should consider the other option which decouples the two counters.
    Of course, using a device with a higher counter resolution (most newer DAQ devices use 32-bit counters) would probably also resolve your issue depending on the full range of  delays that you need.  The downside here is the cost of new hardware.
    Best Regards,
    John Passiak

  • JSplitPane problems : how to set the size of one component to be constant?

    I have a horizontal JSplitPane, the left side of which is occupied by a JTextArea and the right side by a JPanel, which will later contain a JList.
    my problem is:
    when resize I resize the window:
    1. on expanding: the right side of the JSplitPane increases in size ( hence the JPanel increases in size ), while the JTextarea remains the same.
    2. on contracting: the JTextArea keeps becoming smaller and until it nearly vanishes, and then the JPanel starts contracting.
    It does not matter what corner or what size of the JFrame I use to resize it: the result is the same.
    what do i do to reverse the effect but with the following difference:
    On resizing, the following happens:
    1. on expanding: the size of the JPanel remains the same, and the JTextArea keeps getting bigger
    2. on contracting: the size of the JTextArea remains the same, and the JPanel contracts UNTIL IT REACHES A MINIMUM WIDTH. After this width, the JTextArea starts contracting, UNTIL THIS TOO REACHES A MINIMUM SIZE (both height and width). After this limit, no more contraction is possible.
    My code is:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    class MultiEditClient extends JFrame
         public MultiEditClient( String title )
              super(title);
              addComponents();
              addMenu();
         protected void addComponents()
              this.setBounds( 100,100,      500,500 );
              JPanel panel = new JPanel();
              JLabel label = new JLabel( "The to-be status bar." );
              label.setFont( new Font( Font.SANS_SERIF , Font.PLAIN , 14 ) );
              label.setMinimumSize( label.getMaximumSize() );
              JTextArea textarea = new JTextArea();
              textarea.setPreferredSize( new Dimension(400,400) );
              textarea.setMinimumSize( textarea.getMaximumSize() );
              JScrollPane scrollForTextArea = new JScrollPane(textarea);
              JPanel anotherpanel = new JPanel();
              anotherpanel.add( new JButton("Sample Button") );
              JSplitPane splitPane = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, scrollForTextArea, anotherpanel );
              splitPane.setOneTouchExpandable(true);
              panel.setLayout( new BoxLayout(panel, BoxLayout.PAGE_AXIS ) );
              Box vBox = Box.createVerticalBox();
              Box hBox2 = Box.createHorizontalBox();
              hBox2.add( splitPane );
              vBox.add( hBox2 );
              vBox.add( Box.createVerticalStrut(5) );
              Box hBox = Box.createHorizontalBox();
              hBox.add( Box.createHorizontalStrut(5) );
              hBox.add( label );
              hBox.add( Box.createHorizontalGlue() );
              vBox.add( hBox );
              vBox.add( Box.createVerticalStrut(2) );
              panel.add( vBox );
              add( panel );
         protected void addMenu()
              JMenuBar menubar = new JMenuBar();
              JMenu session = new JMenu( "Session" );
              JMenuItem joinSession = new JMenuItem( "Join Session" );
              session.add( joinSession );
              menubar.add( session );
              this.setJMenuBar( menubar );
         public static void main( String args[] )
              MultiEditClient theFrame = new MultiEditClient( "MultiEdit Client" );
              theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              theFrame.pack();
              theFrame.setVisible( true );
    }

    okay...
    I have a JFrame, that contains a JSplitPane with the splitter placed vertically so that it has a left side and a right side.
    In the left side a JTextArea is placed. In the right side a JPanel is placed, whic h will also contain a JList later.
    When I resize the frame along the height of the JFrame, the height of both the components (JTextArea and JPanel) increases - quite natural, no problems here.
    But when I resize the frame along the width I see the following behaviour:
    1. on expanding: the JTextArea retains its width, and the JPanel increases in width.
    2. on contracting: the JTextArea retains its width, and the JPanel contracts.
    after contracting to its minimum width, the JTextArea starts contracting.
    Desired behaviour: the JPanel maintains its width, no matter what. I only what the JTextArea to change in width.
    And after the JTextArea reaches a minimum width, the frame contracts no more ( this i can do by setting the frame's min size ).
    I hope I am more clear and less confusing this time :)
    thanks

  • JSplitPane inside JSplitPane: How to configure the divider?

    I want to split my Frame into three parts. Therefore I want to use two JSplitPanes. (outer and inner)
    The inner one is the lefthand component of the outer JSplitPane. Both have an divider.
    When dragging the divider of the outer JSP to the left side I'm able to resize the width of the inner JSP.
    How can I achieve that the divider of the inner JSP can do the same with the right hand content?
    Any help will oblige.
    Thanks.

    Thanks a lot. Is working.
    But I have used an MouseMotionListener that is assigned directly to the divider.
    ((BasicSplitPaneUI)innerSplitPane.getUI()).getDivider().addMouseMotionListener(myMouseMotionListener);Have nice weekend.

  • Paint divider in JSplitpane

    Hi guys,
    In the code below, I want the divider to be painted with a custom color such as red or whatever else.
    Unfortunatelly, it doesn't.
    I have even try to subclass BasicSplitPaneDivider and set the background to red. The result is still unsatisfactory.
    Doesn't anyone knows how to fix it.
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JSplitPane;
    import javax.swing.JTextArea;
    import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;
    import javax.swing.border.Border;
    import javax.swing.plaf.basic.BasicSplitPaneDivider;
    import javax.swing.plaf.basic.BasicSplitPaneUI;
    public class Splitter {
         private JSplitPane pane;
         public Splitter() {
              pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false);
              setUp();
          * @return the pane
         public JSplitPane getPane() {
              return pane;
         private void setUp() {
              JPanel rightPanel = new JPanel();
              rightPanel.setBackground(Color.white);
              JTextArea area = new JTextArea(40, 50);
              area.setText("Blablaghs");
              Dimension minimumSize = new Dimension(100, 50);
              area.setMinimumSize(minimumSize);
              rightPanel.setMinimumSize(minimumSize);
              pane.setRightComponent(rightPanel);
              pane.setLeftComponent(area);
              pane.setBorder(null);
              pane.setUI(new BasicSplitPaneUI() {
                   public BasicSplitPaneDivider createDefaultDivider() {
                        return new BasicSplitPaneDivider(this) {
                             public void setBorder(Border b) {
                             @Override
                             public void paint(Graphics g) {
                                  g.setColor(Color.red);
                                  super.paint(g);
         private static void createAndShow() {
              try {
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              } catch (ClassNotFoundException e) {
                   e.printStackTrace();
              } catch (InstantiationException e) {
                   e.printStackTrace();
              } catch (IllegalAccessException e) {
                   e.printStackTrace();
              } catch (UnsupportedLookAndFeelException e) {
                   e.printStackTrace();
              Splitter sp = new Splitter();
              JFrame frame = new JFrame("Frame");
              frame.getContentPane().add(sp.getPane());
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setSize(300, 300);
              frame.setVisible(true);
         public static void main(String[] a) {
              createAndShow();
    }Regards.
    Edmond

    Yes, I did.
    If you look at the code I posted, you will recognize a piece of code that I've copied from that tutorial.
    But how can I get the divider be painted in any color I want?
    Regrads.
    Edmond

  • How to set  the Common Pov in Web Analysis

    Dear All,
    Can any one tell me how to set the common Pov for two diffrent reports underon data source in the Web analysis.

    How could it not be 5A?. If you have A for each member and then you select 5 members you are going to get 5A. If you don't want 5A then what do you want the Avg of A across the 5 members?
    The tools are working the way they are designed to, your requirement is a little out of the ordinary. Unfortunately, Web Analysis does not have conditional logic.
    Try taking my previous suggestion and adding another member in Essbase called "Count", make it dynamic calc and the formula should be ' 1; '
    The purpose here is to get a value of one in the count member for each member you are going to select in your filter. So, if you select five members in the filter, Web Analysis will now return 5A and it will return the result of "Count" which will be 5. Create a calculated member that divides the 5A value by the count value 5. That will give you the average A for the 5 members, then you can divide by 12.

  • How to remove the divider at the end of application panel page button bar

    I want to remove the divider at the end of the application panel's page button bar. I dont see a handle in the propery inspector which can be set or unset to remove this divider.
    I am thinking more in lines of something like a "SecondaryToolbarRendered =false" kind of thing to remove this divider.
    Any suggestions?

    Applications Panel is an internal Fusion Apps component. Please post this in Oracle's intrnal ADF Frontnd Forum at myforums.oracle.com.
    We , the world outside Oracle are oblivious to this component :)

  • Set the minimal size of a Component with BorderLayout

    Hi,
    I got a little problem using BorderLayout.
    The scenario is :
    A JPanel placed BorderLayout.WEST got a size a few pixel too small for a JTable contained in this panel to paint all names of the table header.
    If i set the preferredScrollableViewportSize larger then a specific amount the table disappear(shrinks to a tiny size)
    The panel uses GridBagLayout...
    How can i set the size of this "west"-component of the border layout a little larger?
    regards
    Olek

    My understanding of help is an other then only post messages likeWell, your understanding, in my opinion is wrong.
    You must post a self documenting program ...Not everybody who uses this forum speaks english as their main language. Even if english is your main language it is not always easy to communicate the problem effectively. By posting demo code we can see exactly what you are doing.
    Or why you don't read the API... Of course that is a valid answer. You should always read the API. Why should we waste time typing the Documentation from the API when we can point you directly to the API????????
    why you don't search the forum Again, why should be waste time answering questions that have already been answered???????
    You learn by searching the forum and finding multiple solutions, then you use the solution that is appropriate. There is rarely a single solution for all cases. The more knowledge you have the better decision you can make.
    Have a little pride and learn to do some problem solving on your own without us spoonfeeding every anser to you.
    It is not possible to post a short self documenting program ...Then you truly don't understand what the problem is. And if you don't understand what the problem is how to you expect to communicate that problem verbally so that we understand the problem. You question is not about logic its about sizing of components. How hard is it to create a component and add it to a panel to demonstrate the problem. You don't even need real data. For example you can create a JTable with a single line of code, JTable table = new JTable(5, 10).
    the core of the problem depends on the components added to the JSplitPane...Then demonstrate that with a SSCCE.

  • Setting the Image Dimensions

    Hi,
    I'm trying to place objects at various points on a frame. I need to set the coordinates system so that the frame is divided from 1 to 255, (bottom left to top right) regardless of how big it is in pixels. Any suggestions?
    Thanks for your time,
    atreides7887

    Read the documentation for AffineTransform, specifically the methods getTranslateInstance and getScaleInstance.
    You can pass a negative parameter to getScaleInstance to reverse the direction of increasing y-values.
    db

  • Why does the divide operator give me different results in different VIs?

    Hi all,
    I'm quite the LabVIEW newbie, so please forgive me if this is elementary.  I have a signal I am acquiring.  The signal is fairly low amplitude (.01 - 0.1 V).  On each acquisition, I divide the values in the sample set by another small number (0.047) using the divide operator.  I am seeing inconsistent results and I'm puzzled as to why.
    In ex1, which I built from scratch for this post, everything works as expected.  I can confirm with the debugger that each reading in the sample set is properly divided and the mean, max, and waveform graph look as I'd expect.
    When I use a similar construct in my real application, however, the division often results in INF, and when I look with the debugger I see post-divide values in the signal that...just don't make sense to me (ex2).
    I figured I must be missing something in the real application related to splitting up and merging multiple signals, so I tore out everything unrelated to the division (ex3).  Although this code looks a lot like the properly-functioning ex1, the division still produces INFs and strange results.
    All three examples are acquiring the same signal.  My best guess at this point is that the built-from-scratch example is coercing the double passed to the divide operator "the right way" and that the malfunctioning examples are coercing the double in a different, incorrect way.  I've tried removing and recreating the signal path in the malfunctioning examples to no avail.  My problem is that I don't know enough about LabVIEW data types to know how to force the proper coercion.
    Can anyone point me in the right direction for a solution?  I would greatly appreciate some help.
    Solved!
    Go to Solution.
    Attachments:
    ex1.png ‏8 KB
    ex2.png ‏15 KB
    ex3.png ‏10 KB

    I may be getting old, and my eyesight isn't as good as it can be, but I can clearly see that in example 2 and 3 you are not dividing by 0.047. So example 2 and 3 are not the same operation as example 1. The outputs of example 2 and 3 are completely dependent on the signals you are getting. Have you actually looked at those? You are using dynamic data which regulars such as myself absolutely detest. Be that as it may, you should look at the values you are feeding into the operation. I don't understand what you mean by "I see post-divide values in the signal".

  • Set the phone ringer to "silent" ?

    Just got my iPhone today.
    I'm a little surprised that there isn't an obvious way to set the phone ringtone to "silent" from the main screen. In fact, I wasn't really able to figure out how to set it to silent/vibrate only.
    What happens if you're in a meeting and quickly need to change it? I'd expect a button on the main screen for that, at least.
    Have I missed something other than the volume controls on the side?

    Forrest wrote:
    Thank you for the first two constructive replies (I will ignore the third).
    There wasn't a manual with my iPhone - should there have been?
    If you bought it new, yes. Look in the cardboard divider that rests below the iPhone and above the accessories, Mine contains a brochure labeled "Finger Tips" and the FIRST picture shows the location of the four physical controls.
    It also conatins a guide to general use and maintenance in a brochure called "iPhone", and two Apple logo decals.
    Message was edited by: romad
    Message was edited by: romad

  • How do I replace someone else's Mac ID with my own? Bought iPhone second hand. Previous owner re-set the phone but his ICloud account stayed on now my phone. He uses his macID on his new iPhone now?? Any ideas, as this issue is blocking my access to iTune

    How do I replace someone else's Mac ID with my own?
    Bought iPhone second hand on TradeMe.
    Previous owner re-set the phone but his ICloud account stayed on now my phone. He uses his AppleID on his new iPhone now and, understandably, does not want to give me his password. Any ideas?? Please.
    This issue is blocking my access to iTunes and any other file from my home computer. It keeps on telling me that I have to autorise my computer to pass on files, yet, it seems, for all this to happen, I need to get logged in through the phone's Apple ID. This of course is different to my one on my computer - and I have no password for it.
    This phone is not stolen!! I payed still a fair bit for it. Am still in contact with the previous owner. He doesn't know how to fix the problem either.
    Would appreciate any suggestion ????
    Thanks
    SamSings

    Settings>general>resets>erase all content and settings.
    That will put it back to its out of the box state. Set it up with your own apple Id.

  • Set the cursor busy steered by supanel vi

    I let run a vi and there is a subpanel. Is there a way that I can set the cursor busy steered by the subpanel vi. I pass the reference of the mainvi over a global variable into subvi. Without success there is no error message but the busy cursor does not appear. Just setting the cursor in subvi creates a null window error. Is there a easy way to implement it. Or do I have to use user events in main vi called by suvi an then se it busy. Would be not so nice to understand it later.
    kind regards reto

    I attach my test VI (LV 8.0). You can try it.
    Attachments:
    test sub.vi ‏17 KB
    test.vi ‏22 KB
    test global.vi ‏4 KB

  • In an Excel template file, can I set the Folder Path in the SaveAs Dialog box?

    I have an Excel template file (xltm) and, with help from the forum, I now have a Workbook_BeforeSave subroutine to save the template as a macro enabled file (xlsm).  I’m so thankful for that help from Edward in the forum.
    I also want to set the default folder location to save the file. I really only need it when the template is saved as a new xlsm file, because if they open the xlsm file, it’s usually opened from the default folder path so any save would normally go back
    to where the file was opened.  However, with a template (even if the template is in the default folder) the Saved template reverts back to the user’s documents folder.
    Is there a good way to do this?
    I tried to modify the Workbook_BeforeSave code like this:
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Dim FolderDir As String
    Dim FileNameVal As String
    FolderDir = "Z:\save\data\place\"
    If SaveAsUI Then
    If Dir(WorkBookFolder, vbDirectory) <> "" Then
    Application.DefaultFilePath = WorkBookFolder
    End If
    FileNameVal = Application.GetSaveAsFilename(, "Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
    Cancel = True
    If FileNameVal = "False" Then 'User pressed cancel
    Exit Sub
    End If
    ThisWorkbook.SaveAs Filename:=FileNameVal & ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled
    Application.EnableEvents = True
    End If
    End Sub
    But there are a lot of checks that would need to be done.
    I'm not sure how to only default the folder saved only when they open the template, but not change it when they just open an already saved Excel file created by the template (with all the active content, macros, etc.).
    Alan Edwards

    Hi Alan,
    store the path\filename in the 1st argument:
    FileNameVal = Application.GetSaveAsFilename("C:\*.xlsm", "Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
    Andreas.

Maybe you are looking for

  • How do I convert a Quicktime file into an MPG2 in Compressor?

    Every time I try to export my movie as an MPG2 in FCP, it locks up on me. So I exported the movie as a regular Quicktime file in FCP and now I'm wondering what all the steps are to make the file into an MPG2 so that I can burn it to a DVD in DVD Stud

  • Why is there a network name indented?

    Hello, Alright so there is the standard list of Wi-Fi networks available, except one of them is literally indented by at least one letter's width. Does this mean the network is somehow connected with mine? Perhaps a subnet? Or is it just that the nam

  • After data transfered (ALE/IDoc), the data in one of the segment IS GARBAGE

    Hi Experts, I have posted data through ALE/IDoc. I am checking the posted data. in one of the segment the address, street name, name.....etc are looks like "±±¾©»ÝµÂºÀÊ˿Ƽ¼·¢Õ¹ÓÐÏÞ¹«Ë¾"...these are garbage charecters. If I set it ot "Traditionally C

  • Translation Smartform...... URGENT

    Hi, I have translated a smartform through T.Code SE63, but it is not asking for CTS. Could any one please let me know how to attach it to transport. Thanks in advance Regards, sandipan

  • Installation problem photoshop 5.0

    hello! I deinstalled photoshop 5.0 by mistake, and have problems with re-installation. I restarted pc, deactivated kaspersky antivirus and put in CD, but nothing happens except the audible spinning of the CD. No installation dialogue appears on the s