Set minimum size of JScrolPane's knob

Hi All,
Please suggest me a way to set a minimum size of JScrolPane's knob.
It becomes very small when the numbers of items in the list are so much and that time knob is very small. that makes scrolling difficult to the user.
So i want to set a minimum size of the knob.
Please suggest the snippet of code for that

One posible solution is to add a ComponentListener to the
JFrame that implements ... (struggles to remember) ...
componentResized().
Inside componentResized(), check the size of your JFrame,
and if it is smaller than your preferred minimal dimension,
resize it up to your minimum.
// in the constructor, perhaps, or initialization routine
addComponentListener(
  newComponentAdapter()
    public void componentMoved(ComponentEvent e)
        Dimension size = e.getComponent().getSize();
        size.width = Math.max(size.width, myMinimalWidth);
        size.height = Math.max(size.height, myMinimalHeight);
        e.getComponent.setSize(size);
  }); Pity there's no setMinimumSize() like the JComponent class.
Best of luck !
Eric

Similar Messages

  • How to set Minimum size of JFrame?

    Hi,
    I want to set minimum size of my JFrame. How can i set it?
    I want to maintain a minimum size while resizing the JFrame. The user should not resize beyond the minimum size of JFrame.
    Any body knows solution, please post it.
    Thanks in Advance.

    One posible solution is to add a ComponentListener to the
    JFrame that implements ... (struggles to remember) ...
    componentResized().
    Inside componentResized(), check the size of your JFrame,
    and if it is smaller than your preferred minimal dimension,
    resize it up to your minimum.
    // in the constructor, perhaps, or initialization routine
    addComponentListener(
      newComponentAdapter()
        public void componentMoved(ComponentEvent e)
            Dimension size = e.getComponent().getSize();
            size.width = Math.max(size.width, myMinimalWidth);
            size.height = Math.max(size.height, myMinimalHeight);
            e.getComponent.setSize(size);
      }); Pity there's no setMinimumSize() like the JComponent class.
    Best of luck !
    Eric

  • To set minimum size of flash panel

    I am developing a flash panel in PS CS5. I have tried many way to set minimum size of panel window, but they don't work. I have not idea how to do this now. I'm waiting for your HELP. Thank YOU!

    One posible solution is to add a ComponentListener to the
    JFrame that implements ... (struggles to remember) ...
    componentResized().
    Inside componentResized(), check the size of your JFrame,
    and if it is smaller than your preferred minimal dimension,
    resize it up to your minimum.
    // in the constructor, perhaps, or initialization routine
    addComponentListener(
      newComponentAdapter()
        public void componentMoved(ComponentEvent e)
            Dimension size = e.getComponent().getSize();
            size.width = Math.max(size.width, myMinimalWidth);
            size.height = Math.max(size.height, myMinimalHeight);
            e.getComponent.setSize(size);
      }); Pity there's no setMinimumSize() like the JComponent class.
    Best of luck !
    Eric

  • Set minimum size for GridBagLayout

    Hi all,
    I have a dialog which using GridBagLayout. I spent quite a lot of time to test, but still got the following problems. Could anyone give me some solutions?
    1. How do I set the dialog to have a minimum size ?
    Since the dialog is sizeable, so I have to make this limitation to prevent the dialog being too small .
    I tried the following code:
            this.getContentPane().setMinimumSize(new Dimension(686,520));
            this.setMinimumSize(new Dimension(686,520));but it's still not work... , I can still resize it too small.. any other way ?
    2. How do I set its default size when dialog pop up?
    I don't know why the dialog always auto popup in maximum size.
    I have tried to use this.setSize(new Dimension(686, 536)); inside jbInit() function, but still not work...
    Please help ... Thanks a lot.

    Why dont you try this.setResizable(false);?
    Anyway I have given a sample program here using Gridbag layout and this dialog cannot be resized.
    import java.awt.BorderLayout;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import javax.swing.JButton;
    import javax.swing.JDialog;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    public class SunExample28 extends JDialog {
         public SunExample28() {
              setTitle("JDialog with Fixed size");
              JLabel nameLbl = new JLabel("Name:");
              JLabel ageLbl = new JLabel("Age:");
              JTextField nameFld = new JTextField(10);
              JTextField ageFld = new JTextField(10);
              GridBagConstraints gbc = new GridBagConstraints();
              Insets in = new Insets(5,5,5,5);
              JPanel compPanel = new JPanel(new GridBagLayout());
              gbc.gridx = 0;
              gbc.gridy = 0;
              compPanel.add(nameLbl,gbc);
              gbc.insets = in;
              gbc.gridx = 1;
              gbc.gridy = 0;
              compPanel.add(nameFld, gbc);
              gbc.insets = in;
              gbc.gridx = 0;
              gbc.gridy = 1;
              compPanel.add(ageLbl, gbc);
              gbc.insets = in;
              gbc.gridx = 1;
              gbc.gridy = 1;
              compPanel.add(ageFld, gbc);
              JButton okBtn = new JButton("OK");
              JButton cancelBtn = new JButton("Cancel");
              JPanel btnPanel = new JPanel();
              btnPanel.add(okBtn);
              btnPanel.add(cancelBtn);
              getContentPane().add(compPanel, BorderLayout.CENTER);
              getContentPane().add(btnPanel, BorderLayout.PAGE_END);
              setDefaultCloseOperation(DISPOSE_ON_CLOSE);
              setSize(500,300);
              setResizable(false);
          * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              new SunExample28().setVisible(true);
    }

  • How to set minimum size for PieChart wedge?

    The following chart has one wedge that is very thin. I know it is because the data value for that wedge is very small (262) compared to the other wedge data values, but I'd like to be able to set a minimum wedge size.
    Any ideas?
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:Script><![CDATA[
         import mx.collections.ArrayCollection;
         [Bindable]
         public var expenses:ArrayCollection = new ArrayCollection([
            {Expense:"Jan", Amount:2200000},
            {Expense:"Feb", Amount:4700000},
            {Expense:"Mar", Amount:2300000},
            {Expense:"Jul", Amount:262}
      ]]></mx:Script>
      <mx:Panel title="Pie Chart">
         <mx:PieChart id="myChart"
            dataProvider="{expenses}"
            showDataTips="true"
         >
            <mx:series>
               <mx:PieSeries
                    field="Amount"
                    nameField="Expense"
                    labelPosition="callout"
               />
            </mx:series>
         </mx:PieChart>
      </mx:Panel>
    </mx:Application>

    This might be close enough to what you're looking for:
    The FB 4 code is shown below:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx"
        minWidth="955" minHeight="600">
        <fx:Script>
         <![CDATA[
            import mx.charts.HitData;
            import mx.collections.ArrayCollection;
            import mx.controls.Alert;
            import mx.utils.ObjectUtil;
            [Bindable] private var Amount:String = "";
            [Bindable] private var minAmount:String = "";
            [Bindable]
            public var expenses:ArrayCollection = new ArrayCollection([
            {Expense:"Jan", Amount:2200000, minAmount:2200000},
            {Expense:"Feb", Amount:4700000, minAmount:4700000},
            {Expense:"Mar", Amount:2300000, minAmount:2300000},
            {Expense:"Jul", Amount:262, minAmount:50000}
            private function getDataTips(hitData:HitData):String {
                // add percent when the user gets the DataTip
                var percentValue:Number = (hitData.item.Amount / 9200262) * 100;
                var f:int = 3;
                if (percentValue > 1) {
                    f = 1;
                return hitData.item.Expense + ": " + percentValue.toFixed(f) + " % (" + hitData.item.Amount + ")";
            private function getData(series:PieSeries, item:Object, fieldName:String):Object {
                if (item.minAmount != 50000) {
                    return item.Amount;
                    psExpenses.setStyle("labelPosition", "callout");
                } else {
                    return item.minAmount
                    psExpenses.setStyle("labelPosition", "none");
         ]]>
        </fx:Script>
        <mx:Panel title="Pie Chart">
         <mx:PieChart id="myChart"
                 dataProvider="{expenses}" dataTipFunction="getDataTips"
                 showDataTips="true">
            <mx:series>
                <mx:PieSeries id="psExpenses" nameField="Expense" dataFunction="getData"/>
            </mx:series>
         </mx:PieChart>
        </mx:Panel>
    </s:Application>

  • How to set minimum size for the 'location' box in toolbars?

    I reorganized my toolbars by merging the location and tabs bar. I have the location on the left hand side and the tabs *next* to it, like this:
    [ (<)(>) [LOCATION] /tab\/tab\/tab\ ]
    Unfortunately when the number of tabs increases, the location box becomes so small that I cannot even see the url of the site I'm in...
    Is there a way to force a minimum width for the location box? I couldn't find a setting in about:config for it (I imagine that this would be a browser.urlbar setting)

    You rock! The combination of fixed width tabs with the stylish Add-on, and the single line of script below just made my day!
    #main-window[sizemode="maximized"] #TabsToolbar, #TabsToolbar > #urlbar-container { min-width: 350px; }
    Many thanks!

  • Have JFrame respect the minimum size (stop resizing) - Partial solution

    Hi
    I remember I searched for a solution to make JFrame respect the minimum size of itself or it's components, but unfortunately there is no solution, at least not a satisfactory one.
    The force-a-resize-if-it-gets-too-small "solution" looks really bad so I desided to drop the whole thing.
    However I've been testing around with different Look & Feels and changing the layout, and what I discovered is that when setting setDefaultLookAndFeelDecorated(true) the minimum size is respected.
    I haven't seen anyone mentioning this I thought I'd post it here.
    import javax.swing.*;
    import java.awt.*;
    class RespectMinimumSize extends JFrame {
        RespectMinimumSize() {
         setMinimumSize(new Dimension(400, 400));
         setLocationRelativeTo(null);
         pack();
         setVisible(true);
        public static void main(String [] args) {
         JFrame.setDefaultLookAndFeelDecorated(true);
         JDialog.setDefaultLookAndFeelDecorated(true); // Works with JDialog as well
         Toolkit.getDefaultToolkit().setDynamicLayout(true);
         new RespectMinimumSize();
    }

    thanks - initial testing seems to work OK.
    (I had to add a panel, to be able to set minimum size to the panel)

  • Stage should respect minimum size of its content

    Hi,
    I wonder if there was a standardized approach to make the Stage inherits its minimum size from its content.
    I tried to bind the Stage's mimimumWidthProperty to StackPane equivalent but without any success.
    The only way I found was to 'force' the size by explicitly call stage.setMinWidth(), but this not really dynamic.
    For information, the preferred size works fine and is well managed by the Stage.
    Thanks.
    If the following example, the Stage does not respect the minimum size set on the StackPane:
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;
    public class TestMinSize extends Application {
        @Override
        public void start(Stage primaryStage) {
            Button btn = new Button();
            btn.setText("Say 'Hello World'");
            StackPane root = new StackPane();
            // set minimum size
            root.setMinWidth(200);
            root.setMinHeight(200);
            root.getChildren().add(btn);
            Scene scene = new Scene(root, 300, 250);
            primaryStage.setTitle("Hello World!");
            primaryStage.setScene(scene);
            primaryStage.show();
    }

    The only thing that springs to mind is binding the properties to substract the decoration size of the stage.
    But this wouldn't take into account if a child node of your root node has a minWidth/Height larger than the root's.
    And generally this only works if root has a minSizeProperty, but Scene.getRoot() is a Parent.
    primaryStage.minHeightProperty().bind(primaryStage.heightProperty().subtract(scene.heightProperty()).add(root.minHeightProperty()));
    primaryStage.minWidthProperty().bind(primaryStage.widthProperty().subtract(scene.widthProperty()).add(root.minWidthProperty()));Or slightly more general:
    public static void respectMinimumSize(Stage stage) {
         Scene scene = stage.getScene();
         if (scene.getRoot() instanceof Region) {
              Region root = (Region) scene.getRoot();
              stage.minHeightProperty().bind(Bindings.max(0, stage.heightProperty().subtract(scene.heightProperty()).add(root.minHeightProperty())));
              stage.minWidthProperty().bind(Bindings.max(0, stage.widthProperty().subtract(scene.widthProperty()).add(root.minWidthProperty())));
    }Edited by: Dejay on Mar 10, 2013 5:56 PM
    Edited by: Dejay on Mar 10, 2013 5:57 PM

  • How to set a minimum size of a JFrame

    hi freinds,
    i have written a swing application which starts like this ,
    public class workerclass extends JFrame implements ActionListener {
    blah blah blah ..
    now can you please tell me how to set a minimum size for this application once it starts so that user cant minimize it more than that minimum size.....
    when i tried
    setDefaultLookAndFeelDecorated(true);
    it did my job by setting it to a particular size which wasnt minimizable, but this default look and feel looked ugly.
    so i used system look and feel
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    but with this how do i set the minimum size..
    please do help
    and one thing more , like
    in my main Method when i say
    new workerclass().setSize(500,500); or say(100,100) or say(300,300)
    new workerclass().setVisible(true);
    the size (***,***) , doesnt reflect when my application starts, it always starts with some damn fixed size , what can be the issue .
    waiting.........
    Thanks

    how do i set my Jrame to a minimum size so that
    minimizing beyond that can be restrictedThis is what the code is all about
    don't know your code but ..
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class workerclass extends JFrame implements
    ActionListener,ComponentListener {
    public void initcomponenet()
    setJMenuBar();
    pack();
    addComponentListener(this);
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new myclass.setSize(500,500);
    new myclass().setVisible(true);
    public void componentShown(ComponentEvent e)
         public void componentResized(ComponentEvent e)
              if(getWidth()<200)//restrict width to minimum 200
                   setSize(200,getHeight());
    if(getHeight()<100)//restrict Height to minimum
    um 100
                   setSize(getWidth(),100);
         public void componentMoved(ComponentEvent e)
         public void componentHidden(ComponentEvent e)
    Thanks kanad , your code is working ... you desere lot more than a duke dollar but for now i can only give that :-( , please accept it :-)

  • How can I set the minimum size the location bar should automatically resize to

    I have moved all of my navigation buttons, location bar and tabs to be in line. This has been done to maximise the available space on screen.
    This works perfectly with two or three tabs open, but once more tabs are opened the location bar automatically shrinks to allow for more tabs and becomes unusable. I want to set the minimum size the location bar should shrink to but I do not know how to do this.
    [http://www.mediafire.com/imgbnc.php/eed5749531b3081c43186f59492500e5f089c498c0372fb6fa797b7d697826806g.jpg Screen shot displaying automatically resizing location bar]
    Any help would be appreciated.
    Thanks.

    FBZP seems to be the only way to do the minimum amout setting in standard SAP.
    You can check the BTE (Business transaction event) 00001820 for excluding the low amount items in F110. Please search SDn on how to use the BTEs.
    Regards,
    SDNer

  • Setting JFrames minimum size

    how do i set the minimum size of a JFrame
    thanks
    Phil

    You can't set it, but you can control it by adding a component listener to the JFrame:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=245747

  • How to set minimum height size for an empty XML Form iview

    Hi,
    I'm trying to configure the minimum height size of an XML Form iview without sucess. Even when there is no content to show, iview height size is around 80 pixels. When there is content the automatic configuration works fine and the iview is resized properly.
    The iview has automatic size and the minimum size for automatic is with 5 pixels...
    Any ideas?
    Thanks,
    Marcelo

    Hi,
    I'm trying to configure the minimum height size of an XML Form iview without sucess. Even when there is no content to show, iview height size is around 80 pixels. When there is content the automatic configuration works fine and the iview is resized properly.
    The iview has automatic size and the minimum size for automatic is with 5 pixels...
    Any ideas?
    Thanks,
    Marcelo

  • How to set the minimum size of app window?

    Hi JavaFX experts :)
    Is it possible to limit the minimum size of application window? What would be the JavaFX equivalent of the following SWING code?
            JFrame frame = new JFrame("Application Title");
            frame.setMinimumSize(new Dimension(320, 240));
            frame.setPreferredSize(new Dimension(640, 480));Preferred or initial size was easy (width/height), but what about the minimum size?
    Stage {
        title: "Application Title"
        width: 640
        height: 480
        scene: Scene {
            content: [
                // some content
    }Thanks!

    var stage: Stage;
    var stageWidth = stage.width on replace
        if (stageWidth < 640) stageWidth = 640;
    var stageHeight = stage.height on replace
        if (stageHeight < 400) stageHeight = 400;
    stage = Stage {
        title: "Application Title"
        width: bind stageWidth with inverse
        height: bind stageHeight with inverse
        scene: Scene {
            content: [
                // some content
    }It doesn't prevent resizing to smaller dimensions but it restores to minimal dimension if done.

  • Setting a JLabel's minimum size

    Hello,
    I have a container with a GridBag layout, and when I resize to a size wher everything fits its fine, but on the bottom of the window I have a JLabel, which can be quite large sometimes. When it is large, its minimum size is the length of the string, so when I resize its container i get some big ugly scroll bars and its contents dont get any smaller, although every other component can be much smaller.
    What I would like is for the JLabel to have a minimum size (say 100 pixels) and if the window is resized less than this, introduce scroll bars, otherwise just cut off some of the text, as the label isn't very important!
    I have tried loads of different stuff, the most obvious being JLabel.setMinimumSize(new Dimension(100,16)); but nothing seems to have worked, can anyone help?

             public void updateVideoInfo(){
              String str = " ";
              str = "  " + videoData.getCurrentCameraProperties().getDeviceName()+" at " + videoData.getWidth() + " by " + videoData.getHeight();
              videoInfo.setText(str);
              int width = this.getSize().width - play.getSize().width - stop.getSize().width;
              videoInfo.setPreferredSize(new Dimension(width-15,16));
         public void validate(){
              updateVideoInfo();
         }I did a quick work arround, which I had tried before but didnt work for some reason... but has now
    But this would be awfull to change If i ever add anything in the future so I will look at what you said!

  • How to set the size for height of iView tray?

    Hi,
    I have created a ABAP webdynpro component and integrated this comp with iView. Then i integrated iView into Page in portal. That is working fine.
    But the size of tray/window which is displayed in the page is very small.
    How to increase the height of that Tray/window/iView containing my component?

    Hi,
    By changing the maximum automatic height and Minimum automatic height property of the iview you can set the size for height of your iview.
    to do this follow the setps:
    goto content administrator -> portal content -> your folder where you created your iview or directly to your iview -> right click -> open -> object,
    and now in property category choose appearance-Size from the drop down menu and set the above properties to your required height.
    if you want the end user to modify this property set the property to read/write .
    *********please reward points if the information is helpful to you********************

Maybe you are looking for

  • PO Release Strategy not changed after deletion of few line items with less

    Subject : PO Release Strategy not changed after deletion of few line items with less Total PO Dear Friends We have issue with PO Release strategy. We have created the PO. with release strategy  with multiple approvers.  After approval of first approv

  • How to add a new custom field to one set of employees within one country?

    Hi, I am thinking of a scenario where a new custom field is dispayed in PA30 for IT0006 only for one set of employees in US (such as for a employee group or employee sub group). Other employees should not have this custom field. All employees in this

  • Adobe Form Data Storage

    When a user fills up a PCR Adobe Form from the portal where does the data or information is stored? There should be a fundamental way that SAP stores Adobe form data. I want to understand how and where this data is placed in SAP prior to it updating

  • Issue with UPK

    Hi, I have installed UPK 12.1 with Oracle database in Server-client architecture. But when I tried to access the, http://hostname/ODSConent, getting below error.   HTTP Error 403.14 - Forbidden  Please help me to solve

  • Check table 169p: entry bal does not exist

    hi experts, this error (Check table 169p: entry bal does not exist) is comming while my end user is doing goods receit in t code MIGO .bal is the name of the com code and business area thanks&regards surya varma