Gridbag layout - set size

can I set a pixel width size for the cell of a gridbag?

Set the minimum width and height as well as preferred width and height and let the layout manager take care of the size.
You can not set the absolute width and height because components under GridbagLayout do not have adjustable size. Their size is determinded by layout manager, and the only thing you can set is the layout constraints and minimum/maximum/preferred size.

Similar Messages

  • JTextArea & Gridbag layout - max size of control

    Hello everyone:
    I am currnetly using a JTextArea with the Gridbag layout. I want to limit the size of the JTextArea. Found an article when I did a "search" that says the size is actually controlled by the layout manager. Have tried setMaximunSize(), no luck. It appears the layout manager ignores this. The problem I am having is that I can set the size I want, however if the user types a lot of text in to the JTextArea, the control expands and over and "pushes" the controls below it down. How do I keep the layout manager from allowing this to happen?
    Thanks in advance, Bart

    Hello everyone:
    I am currnetly using a JTextArea with the Gridbag
    layout. I want to limit the size of the JTextArea.
    Found an article when I did a "search" that says the
    size is actually controlled by the layout manager.
    Have tried setMaximunSize(), no luck. It appears the
    layout manager ignores this. The problem I am having
    is that I can set the size I want, however if the user
    types a lot of text in to the JTextArea, the control
    expands and over and "pushes" the controls below it
    down. How do I keep the layout manager from allowing
    this to happen?
    Thanks in advance, Bart Do you wish to allow the user to enter as much text as he or she likes? If so, wrap the JTextArea in a JScrollPane and set the preferred size of the JScrollPange to the area you'd like the pane to consume. It'll listen, no doubt. :)

  • JTextArea & Gridbag layout

    Hello everyone:
    I am currnetly using a JTextArea with the Gridbag layout. I want to limit the size of the JTextArea. Found an article when I did a "search" that says the size is actually controlled by the layout manager. Have tried setMaximunSize(), no luck. It appears the layout manager ignores this. The problem I am having is that I can set the size I want, however if the user types a lot of text in to the JTextArea, the control expands and over and "pushes" the controls below it down. How do I keep the layout manager from allowing this to happen?
    Thanks in advance, Bart

    Have set the rows and columns as you suggested in the original code,and get the size I want initalially. The problem is that the JTextArea will increase past the size set so it "bleeds" downward. I looked in the Java book I have, and it says that the scrollbars for a JTextArea are provided automatically, however they do not appear when the user supplies more lines of text than there are rows. Instead the height of the control is enlarged and this in turn pushes the other controls on the pane down. Is this a mi-print in the book, ie the scroll bars are not automatically provide in a JTextArea?
    Thanks,
    Bart

  • Possible Problem/Bug In GridBag Layout ????

    I've done hundreds of Gridbag layouts in the past 2 years and just noticed this weird little behavior today.....
    Basically what I'm trying to do is arrange panels like this.....
    +--------+--------+--------+
    |        |        |        |
    |   A    |    B   |   C    |
    |        |        |        |
    +--------+----+---+--------+
    |             |            |
    |     D       |      E     |
    |             |            |
    +-------------+------------+The obvious thing to do is to
    o make the gridwidths of
    B, D, E = 2
    A, C = 1
    D and E should each share one unit of
    B's 2 width.
    Tried it in my code with my real UI and it didn't work, so then I tested it
    out using a Gridbag tool where you can set parameters on the fly quickly and
    surely enough it did not work there either.
    The GridBagLayout is refusing to split B into 2 portions for the 2nd row
    to use in an unalligned fashion. I either get
    +--------+--------+--------+
    |        |        |        |
    |   A    |    B   |   C    |
    |        |        |        |
    +--------+----+---+--------+
    |        |                 |
    |     D  |           E     |
    |        |                 |
    +--------+-----------------+  or
    +--------+--------+--------+
    |        |        |        |
    |   A    |    B   |   C    |
    |        |        |        |
    +--------+----+---+--------+
    |                 |        |
    |     D           |  E     |
    |                 |        |
    +--------+--------+--------+ depending on the order in which I add my panels to the layout.
    even though my gridx, gridy and widths and heights are properly set for
    obtaining the result I want.
    Can someone confirm that this is a bug in the GridBagLayout or share the trick for
    getting around this?

    Thanks for the reply - I can set the weights however
    I wish and I never see box D extending even one pixel
    into the A-B boundary.This does what you say...
    import java.awt.*;
    import javax.swing.*;
    public class TestFrame extends JFrame {
      public TestFrame() {
        JPanel panel = new JPanel(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.fill = GridBagConstraints.BOTH;
        gbc.weighty = 0.5; 
        panel.add(new JButton("A"), gbc);
        gbc.gridx = 1;   
        gbc.gridwidth = 2; 
        panel.add(new JButton("B"), gbc);
        gbc.gridx = 3;   
        gbc.gridwidth = 1;
        panel.add(new JButton("C"), gbc);
        gbc.gridx = 0;
        gbc.gridy = 1;
        gbc.gridwidth = 2;
        gbc.weightx = 0.5;
        panel.add(new JButton("D"), gbc);
        gbc.gridx = 2;
        panel.add(new JButton("E"), gbc);
        getContentPane().add(panel);
        setSize(400, 300);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
      public static void main(String[] args) {
        TestFrame frame = new TestFrame();
        frame.setVisible(true);
    }But i'm sure it's not a satisfactory layout because button A does not want to resize horizontally at all. But of course, a mix of grid layouts does the trick:
    import java.awt.*;
    import javax.swing.*;
    public class TestFrame extends JFrame {
      public TestFrame() {
        JPanel panel = new JPanel(new GridLayout(2, 1));
        JPanel top = new JPanel(new GridLayout(1, 3));
        top.add(new JButton("A"));
        top.add(new JButton("B"));
        top.add(new JButton("C"));
        panel.add(top);
        JPanel buttom = new JPanel(new GridLayout(1, 2));
        buttom.add(new JButton("D"));
        buttom.add(new JButton("E"));
        panel.add(buttom);
        getContentPane().add(panel);
        setSize(400, 300);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
      public static void main(String[] args) {
        TestFrame frame = new TestFrame();
        frame.setVisible(true);
    }

  • JPanel Positiong with Gridbag Layout Problem

    Hi,
    I'm desingning an UI in which I made a JFrame and set it Layout as gridBag layout. Now I have added Three JPanel in this JFrame.
    The problem is that All the three JPanels are shown in center While I want to palce them in top left corner.
    I have done this through NetBeans 4.0 in the layout coustomize option I've set them in first in the left top most, second in below of the first and so on but when I run the application The JPanel are shown in the center in this Particular position i.e first at the top in center second below to the fist and so on.
    Kindly solve my this problem.
    Regards,
    Danish Kamran.

    To get better help sooner, post a SSCCE that clearly demonstrates your problem.
    Use code tags to post codes -- [code]CODE[/code] will display asCODEOr click the CODE button and paste your code between the {code} tags that appear.
    db

  • Gridbag layout problem on a tabbedpane

    I am not sure whether we can do this or not but, I am trying to have a gridbag layout on a TabbedPane object.
    I have a JFrame on which I am adding a TabbedPane object called "t" and on this TabbedPane I am adding a tab called "Insert" which is an object of class "Insert Data". Then, I add the TabbedPane t on the Container cp, which is inside the JFrame.
    In the InsertData Class (a JPanel), I need to have the gridbag layout. With this gridbag layout object, I am trying to place different objects like buttons, at various places, on this JPanel. But nothing moves on this panel.
    In short, please let me know how can I have a gridbag layout on a Tabbedpane.
    The Main Class is as follows:
    import java.awt.Color;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import javax.swing.JFrame;
    import javax.swing.JTabbedPane;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class Main extends JFrame implements ActionListener, ChangeListener{
         Main(){
                   setPreferredSize(new Dimension(1200,600));
                   Container cp = getContentPane();
                   JTabbedPane t = new JTabbedPane();
                   // insert
                   InsertData insertOptions = new InsertData();
                   t.addTab("Insert",insertOptions);
                   cp.add(t);
                   this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   pack();
                   setVisible(true);
              @Override
              public void actionPerformed(ActionEvent arg0) {
                   // TODO Auto-generated method stub
              @Override
              public void stateChanged(ChangeEvent arg0) {
                   // TODO Auto-generated method stub
              public static void main(String args[]){
                   new Main();
         }The InsertDataClass is:
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class InsertData extends JPanel{
         InsertData(){
              setPreferredSize(new Dimension(1200,600));
              setBackground(Color.blue);
              //setLayout(new GridBagLayout());
              GridBagLayout gb = new GridBagLayout();
              setLayout(gb);
              GridBagConstraints c = new GridBagConstraints();
              //c.insets = new Insets(2, 2, 2, 2);
              //JPanel p1= new JPanel();
              //p1.setPreferredSize(new Dimension(200,200));
              JButton b1 = new JButton("here i am!!!");
              //p1.add(b1);
              //c.fill = GridBagConstraints.HORIZONTAL;
              //c.anchor = GridBagConstraints.WEST;
              c.gridx=0;
              c.gridy=1;
              add(b1,c);
    }

    how can I have a gridbag layout on a Tabbedpane.Huh? You post an example with just one JButton and no weightx / weighty set and you expect others here to be able to see a problem with your layout?
    Also, there's needless, unused code that is just clutter -- like the unimplemented ActionListener and ChaneListener. Recommended reading: [SSCCE (Short, Self Contained, Compilable and Executable, Example Program)|http://mindprod.com/jgloss/sscce.html].
    Finally, I don't see any need whatsoever to extend JFrame and JPanel as you are not introducing any new behavior of either. Always favor composition over inheritance.
    I plugged in some code I had used for someone else's GridBagLayout problems and this will show you that there's no difference in using GridBagLayout in a tabbed pane component or anywhere else.import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import javax.swing.*;
    public class GridBagInTabbedPane {
      public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            new GridBagInTabbedPane().makeUI();
      public void makeUI() {
        Font fontButton = new Font("Arial", Font.BOLD, 10);
        Font fontLabel = new Font("Arial", Font.BOLD, 15);
        JLabel labelEnter = new JLabel("Enter sentences in the text area ");
        labelEnter.setFont(fontLabel);
        JTextArea textArea = new JTextArea();
        textArea.setPreferredSize(new Dimension(630, 280));
        JScrollPane scrollPane = new JScrollPane(textArea);
        scrollPane.setMinimumSize(new Dimension(630, 280));
        JLabel labelDuplicates = new JLabel("Duplicates will appear here");
        labelDuplicates.setMinimumSize(new Dimension(650, 30));
        labelDuplicates.setFont(fontLabel);
        JButton buttonDisplay = new JButton("Display Map");
        buttonDisplay.setFont(fontButton);
        JButton buttonClear = new JButton("Clear");
        buttonClear.setFont(fontButton);
        JPanel panel = new JPanel(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.gridwidth = 2;
        gbc.fill = GridBagConstraints.NONE;
        gbc.anchor = GridBagConstraints.CENTER;
        gbc.insets = new Insets(5, 5, 5, 5);
        gbc.weightx = 0.5;
        panel.add(labelEnter, gbc);
        gbc.gridy = 1;
        gbc.fill = GridBagConstraints.BOTH;
        gbc.weighty = 0.5;
        panel.add(scrollPane, gbc);
        gbc.gridy = 2;
        gbc.fill = GridBagConstraints.NONE;
        gbc.weighty = 0.0;
        panel.add(labelDuplicates, gbc);
        gbc.gridy = 3;
        gbc.gridwidth = 1;
        gbc.anchor = GridBagConstraints.EAST;
        panel.add(buttonDisplay, gbc);
        gbc.gridx = 1;
        gbc.anchor = GridBagConstraints.WEST;
        panel.add(buttonClear, gbc);
        JTabbedPane tabbedPane = new JTabbedPane();
        tabbedPane.add(panel);
        JFrame frame = new JFrame();
        frame.add(tabbedPane);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }db

  • Translation of layout set properties

    Hello,
    I created a custom layout set to display customized properties: size, date of creation and date of last modification.
    All is good, except that i need to translate column headers to different languages. I added them in collection renderer settings (displayed proeprties: contentlength, created, modified)
    I know how to do translate using Portal Content Translation, but these translation are for portal content items only. How do i translate those  i.e column header names)
    Any help will be appreciated!

    Wrong space, this is the Netweaver Gateway space - nothing to do with Portal Content!

  • Gridbag layout continues to confound me...

    I am having problems with the gridx and gridy constraints when trying to use gridbag layout. They seem to have no effect when I use them. The button always appears in the top left of the panel. Other constraints seem to work as expected.
    For example: c2.fill = GridBagConstraints.BOTH; will fill up the entire panel with my button.
    Any advice on what I am doing wrong this time?
    Thanks
    import javax.swing.JPanel;
    import javax.swing.JTextArea;
    import javax.swing.JScrollPane;
    import javax.swing.JFrame;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.awt.Color;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.text.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Question
         public JPanel test()
              JPanel testPanel = new JPanel(new GridBagLayout());
              GridBagConstraints c2 = new GridBagConstraints();
              c2.insets = new Insets(5,5,5,5);
              c2.weightx = 1.0;
              c2.weighty = 1.0;
              c2.anchor = c2.NORTHWEST;
              JButton redButton = new JButton("Button");
              c2.gridx = 2;
              c2.gridy = 2;
              //c2.fill = GridBagConstraints.BOTH;//this works as expected
              testPanel.add(redButton,c2);
              return testPanel;
         public Container createContentPane()
              //Create the content-pane-to-be.
              JPanel contentPane = new JPanel(new BorderLayout());
              contentPane.setOpaque(true);
              return contentPane;
         private static void createAndShowGUI()
              //Create and set up the window.
              JFrame frame = new JFrame("question");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              //Create and set up the content pane.
              Question demo = new Question();
              frame.setContentPane(demo.createContentPane());
              frame.add(demo.test());
              //Display the window.
              frame.setSize(400, 400);
              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();
        }//end main
    }//end Question

    GridBagLayout keeps zero width/height grid for non-existant component for the grid.
    You could override this behavior by using GBL's four arrays as shown below.
    However, in order to get the desired layout effect, using other layout manager, e.g. BoxLayout and/or Box, is much easier and flexible as camickr, a GBL hater, suggests.
    Anyway, however, before using a complex API class as GBL, you shoud read the documentation closely.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Question{
      // you may adjust these values for your taste
      static final int rowHeight    = 100;
      static final int colWidth     = 100;
      static final double rowWeight = 1.0;
      static final double colWeight = 1.0;
      public JPanel test(){
        GridBagLayout gb = new GridBagLayout();
        gb = keepAllRowsAndColumns(gb, 3, 3);
        JPanel testPanel = new JPanel(gb);
        GridBagConstraints c2 = new GridBagConstraints();
        c2.insets = new Insets(5,5,5,5);
        c2.weightx = 1.0;
        c2.weighty = 1.0;
        c2.anchor = c2.NORTHWEST;
        JButton redButton = new JButton("Button");
        c2.gridx = 2;
        c2.gridy = 2;
        // c2.fill = GridBagConstraints.BOTH;//this works as expected
        testPanel.add(redButton,c2);
        return testPanel;
      GridBagLayout keepAllRowsAndColumns(GridBagLayout g, int rn, int cn){
        g.rowHeights = new int[rn];
        g.columnWidths = new int[cn];
        g.rowWeights = new double[rn];
        g.columnWeights = new double[cn];
        for (int i = 0; i < rn; ++i){
          g.rowHeights[i] = rowHeight;
          g.rowWeights[i] = rowWeight;
        for (int i = 0; i < cn; ++i){
          g.columnWidths[i] = colWidth;
          g.columnWeights[i] = colWeight;
        return g;
      private static void createAndShowGUI(){
        JFrame frame = new JFrame("question");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Question demo = new Question();
        frame.getContentPane().add(demo.test(), BorderLayout.CENTER);
        frame.setSize(400, 400);
        frame.setVisible(true);
      public static void main(String[] args){
        javax.swing.SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            createAndShowGUI();
    }

  • Gridbag Layout and Tabbed Panes

    First off, I'm pretty new to Java, I started it around February as a school course, and it's been a pretty smooth ride. Recently, we started to code GUI, trying out different layouts and whatnot. I'm having a little trouble in this portion as our teacher did not really delve into it very much. My question concerns the GridBag layout within a panel of a tab (sorry if this is unclear, I'm talking about something that looks like this: http://www.codeproject.com/useritems/tabcontrol.asp). I don't know how to use GridBag constraints within a panel. What I used to do with GridBag was simply use some code that looked like (forgive me, this might not be very accurate): AddComponent button1(#, #, #, #) and define what each of those numbers meant later (first would be row, second would be column, third would be width, fourth would be height, for example). But now, with the tabs, each button, label, or any other control would be declared, then I would place a bunch of direct constraints after, like this:
    JButton button1 = new JButton("1");
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;then add them into the panel like this:
    panel1.add(button1, constraints);However, I have tried making the buttons on top of each other, and other patterns, but it would just place the buttons next to each other within the panel. How do I make it so that the constraints work? Or rather, if they do work, what kinda things might mess it up? I think the problem is that I dunno how to make the constraints specific to that one button.
    Also, how do I make each panel a certain size instead of each panel being as small as possible to contain anything within it.
    I'm sorry if this all sounds very vague, I'd be more than happy to give you any needed information. Also, I'm not asking any of you to do my homework, I just need a little clarification or an example. Just in case, here's the code I'm working on: http://hashasp.mine.nu/paster/?1376. Be aware that there are no comments or anything, it's very bare. Also, the form may be a bit messy because I'm pretty much reusing code that was given to me, just manipulating it in a different way. Thanks a lot in advanced for your time in reading this.

    * GridBag_Demo.java
    import java.awt.*;
    import javax.swing.*;
    public class GridBag_Demo extends JFrame {
        public GridBag_Demo() {
            setTitle("GridBag Demo");
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            setSize(400,300);
            setLocationRelativeTo(null);
            GridBagConstraints gridBagConstraints;
            jTabbedPane1 = new JTabbedPane();
            jPanel1 = new JPanel();
            jButton1 = new JButton();
            jButton2 = new JButton();
            jButton3 = new JButton();
            jPanel1.setLayout(new GridBagLayout());
            jButton1.setText("jButton1");
            gridBagConstraints = new GridBagConstraints();
            gridBagConstraints.insets = new Insets(2,2,2,2);
            jPanel1.add(jButton1, gridBagConstraints);
            jButton2.setText("jButton2");
            gridBagConstraints.gridy = 1;
            jPanel1.add(jButton2, gridBagConstraints);
            jButton3.setText("jButton3");
            gridBagConstraints.gridy = 2;
            jPanel1.add(jButton3, gridBagConstraints);
            jTabbedPane1.addTab("tab1", jPanel1);
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
        public static void main(String args[]) {
            new GridBag_Demo().setVisible(true);
        private JButton jButton1;
        private JButton jButton2;
        private JButton jButton3;
        private JPanel jPanel1;
        private JTabbedPane jTabbedPane1;
    }

  • How to make JLabel Left Justified in Gridbag Layout?

    Hi Govind here I am using Gridbag layout and having Labels and TextBox . i want my All my Labels Left Justified (Currently they are RightJustified),I tried JLabel.Left but not working so any help most welcome............
    JLabel startDateLabel      = new JLabel("STARTDATE ",JLabel.LEFT);
              startDateLabel.setBorder( border );                                   
              //set the position of the label               
              gbc.fill = GridBagConstraints.NONE;
              usingGBC(startDateLabel,gbc,3,0,1,1.0);
                   //text field for start dat
    txtStartDate                = new JTextField();
              txtStartDate.setMinimumSize(minSize);
              txtStartDate.setPreferredSize( longField );
              txtStartDate.setEnabled( true);                    
              txtStartDate.setEditable(false);
              txtStartDate.setBackground(Color.WHITE);          
              gbc.fill = GridBagConstraints.HORIZONTAL;
              usingGBC(txtStartDate,gbc,4,0,2,1.0);
         here usingGBC is method as follows
    protected void usingGBC(Component com,GridBagConstraints gbc,int gx,int gy,int gwidth,double wx)
                   gbc.gridx = gx;
                   gbc.gridy = gy;
                   gbc.gridwidth = gwidth;
                   gbc.weightx = wx;
                   add(com,gbc);

    It seems you set the fill of the GridBagConstraints after you add the label. Either specify HORIZONTAL fill before adding the label or specify alignment for the constraints.
    Mike

  • Set size and location of  a component

    Hello,
    Does anyone familiar with this org.netbeans.lib.awtexttra.AbsoluteConstraints(). I want to set the size and location of the component, and I know this org netbeans can provide this function.
    getContentPane().add(chkTausta, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 120, -1, -1));
    chkRakkennus.setSelected(true);
    chkRakkennus.setText("Rakennukset");
    then it comes an error that org.netbeans.lib.awtextra.AbsoluteConstraints()cannot be resolved. Does anyone know what�s the reason. Do I have to download other version of Java. I have Jre1.6.0?
    Does anybody knows is there another way to set size of component. For example, if I use borderlayout, and put a button to the west, then how can I set the location and size of the button?
    Thanks a lot for you help.
    Clare

    org.netbeans.lib.awtextra.AbsoluteConstraints isn't part of the JDK. I suggest you don't use that at all. Let a LayoutManager do the resizing.
    Have a look at the [Layout tutorial|http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html] especially gridBagLayout

  • Setting size of Label!!!

    I have problem in setting size of label. Actually I have atttached some labels in a pannel. I want to set different size for each label. I there any way i can explicitly set the size of labels.
    Thanx in advance.

    The layout manager you use wont necessarily let you do that... Call first setLayout(null), and only then setSize and setLocation if you want to layout the components yourself.

  • Layout Set : Show Folder Content

    How can i show the contents of folder in main page if i use AdminExplorer or ConsumerTreeList layout set.
    What i am looking is to display the content in the main page rather than clicking on folder link which takes to next page with contents.
    For e.g
    Folder A                  Size   Modified  Modifiedby    
        Document1              30KB  1-mar-06  user1
        Document2              30KB  1-mar-06  user1
    Folder B                
        Document1              30KB  1-mar-06  user1
        Document2              30KB  1-mar-06  user1
    I appreciate any suggestions or ideas.
    Thanks
    Tegala

    Hi,
      Prakash Singh has provided a ready to use code to have KM repository custom views. you can make modificationd to meet your requirement.
    refer:
      Build Your Own KM Navigation iView Using HTMLB Tree
    Hope that helps.
    Regards,
    S.Divakar

  • GridBag Layout help

    Hey all,
    I'm currently revamping an application I wrote for my company that I wrote with a GridLayout. It doesn't look bad, but it doesn't look as good as a standard windows application. I'd like to write it using a gridbag layout in order to make it look a little better but no where can I find a good idea of how to even use it... Javadocs on it seem kinda cryptic to me and I'd like a better visual example than just a bunch of buttons (which is what the tutorial gives). Anyone have any ideas where I can look?

    Here is a simple example of some of my code that uses the gridbag layout. (slightly modified so it will run by itself...). I added some comments on what some of the different settings do...
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import java.text.*;
    import javax.swing.event.*;
    import java.util.Properties;
    * trackWindow.java
    * Created October 24, 2002, 6:26 PM
    * This class is used to display a tabbed internal window that is used to
    * display and control the settings required for localizing particles and
    * tracking their movement as part of the Trackguy program.
    public class trackWindow2 extends JInternalFrame implements ActionListener {
         private JTabbedPane trackTabPanel;
         private JPanel maskPanel;
         private JPanel trackPanel;
         private JLabel multLabel;
         private JTextField multiplier;
         private JLabel threshLabel;
         private JTextField threshold;
         private JToggleButton dilate2;
         private JToggleButton partBK;
         private JLabel partSizeLabel;
         private JTextField minPartSize;
         private JLabel scaleLabel;
         private JLabel tIntervalLabel;
         private JLabel xScaleLabel;
         private JTextField xScale;
         private JLabel yScaleLabel;
         private JTextField yScale;
         private JTextField tInterval;
         private JLabel timeUnitLabel;
         private JLabel maxDifLabel;
         private JTextField maxDif;
         private JLabel minTrackLabel;
         private JTextField minTrack;
         private JLabel difCoefLabel;
         private JTextField difCoef;
         public trackWindow2 () {
                initFields();
                collectPanels();
                buildWindow();
                setIcon();
                show();
         private void initFields() {
                multLabel = new JLabel("Multiplier: ");
                multiplier = new JTextField("10");
                multiplier.setActionCommand("multiplier");
                multiplier.setPreferredSize(new Dimension(40, 18));
                multiplier.addActionListener(this);
                threshLabel = new JLabel("Threshold: ");
                threshold = new JTextField("32770");
                threshold.setActionCommand("threshold");
                threshold.setPreferredSize(new Dimension(40, 18));
                threshold.addActionListener(this);
                dilate2 = new JToggleButton("Dilate 2 X");
                dilate2.addActionListener(this);
                partBK = new JToggleButton("Particle BK");
                partBK.addActionListener(this);
                partSizeLabel = new JLabel("Min Particle Size: ");
                minPartSize = new JTextField("9");
                minPartSize.setActionCommand("part. size");
                minPartSize.setPreferredSize(new Dimension(40, 18));
                minPartSize.addActionListener(this);
                scaleLabel = new JLabel("Scale");
                tIntervalLabel = new JLabel("Time Interval");
                xScaleLabel = new JLabel("x = ");
                xScale = new JTextField("1.08e-007");
                xScale.setActionCommand("xScale");
                xScale.setPreferredSize(new Dimension(60, 18));
                xScale.addActionListener(this);
                yScaleLabel = new JLabel("y = ");
                yScale = new JTextField("1.08e-007");
                yScale.setActionCommand("yScale");
                yScale.setPreferredSize(new Dimension(60, 18));
                yScale.addActionListener(this);
                tInterval = new JTextField("1.5");
                tInterval.setHorizontalAlignment(JTextField.CENTER);
                tInterval.setActionCommand("tInterval");
                tInterval.setPreferredSize(new Dimension(40, 18));
                tInterval.addActionListener(this);
                timeUnitLabel = new JLabel("Sec.");
                timeUnitLabel.setHorizontalAlignment(SwingConstants.LEFT);
                maxDifLabel = new JLabel("Max. Difference: ");
                maxDif = new JTextField("50");
                maxDif.setActionCommand("difference");
                maxDif.setPreferredSize(new Dimension(40, 18));
                maxDif.addActionListener(this);
                minTrackLabel = new JLabel("Min. Track: ");
                minTrack = new JTextField("20");
                minTrack.setActionCommand("minTrack");
                minTrack.setPreferredSize(new Dimension(40, 18));
                minTrack.addActionListener(this);
                difCoefLabel = new JLabel("Diff. Coefficient:");
                difCoef = new JTextField("6.00e-14");
                difCoef.setActionCommand("coefficient");
                difCoef.setPreferredSize(new Dimension(60, 18));
                difCoef.addActionListener(this);
         private void collectPanels() {
                GridBagConstraints gridBagConstraints;
                maskPanel = new JPanel();
              maskPanel.setLayout(new GridBagLayout());
                gridBagConstraints = new GridBagConstraints();
                //1st Column
                   gridBagConstraints.gridx = 0;
                //1st Row
                   gridBagConstraints.gridy = 0;
                //Stuck to the Left of the Column
                   gridBagConstraints.anchor = GridBagConstraints.WEST;
                maskPanel.add(multLabel, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                 gridBagConstraints.gridx = 1;
                     gridBagConstraints.gridy = 0;
                   gridBagConstraints.anchor = GridBagConstraints.WEST;
                maskPanel.add(multiplier, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 0;
                   gridBagConstraints.gridy = 1;
                   gridBagConstraints.anchor = GridBagConstraints.WEST;
                maskPanel.add(threshLabel, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 1;
                   gridBagConstraints.gridy = 1;
                   gridBagConstraints.anchor = GridBagConstraints.WEST;
                maskPanel.add(threshold, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 0;
                   gridBagConstraints.gridy = 2;
                maskPanel.add(dilate2, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 1;
                   gridBagConstraints.gridy = 2;
                maskPanel.add(partBK, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 0;
                   gridBagConstraints.gridy = 3;
                   gridBagConstraints.anchor = GridBagConstraints.WEST;
                maskPanel.add(partSizeLabel, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 1;
                   gridBagConstraints.gridy = 3;
                 gridBagConstraints.anchor = GridBagConstraints.WEST;
                maskPanel.add(minPartSize, gridBagConstraints);
                trackPanel = new JPanel();
                trackPanel.setLayout(new GridBagLayout());
                gridBagConstraints = new GridBagConstraints();
                //1st Column
                   gridBagConstraints.gridx = 0;
                //1st Row
                   gridBagConstraints.gridy = 0;
                //2 Columns Wide
                   gridBagConstraints.gridwidth = 2;
                //40 empty pixels to Left of the Component
                   gridBagConstraints.insets = new Insets(0, 40, 0, 0);
                trackPanel.add(scaleLabel, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                //3rd Column
                   gridBagConstraints.gridx = 2;
                //1st Row
                   gridBagConstraints.gridy = 0;
                //2 Columns wide
                   gridBagConstraints.gridwidth = 2;
                //5 empty pixels to the left of the component
                   gridBagConstraints.insets = new Insets(0, 5, 0, 0);
                trackPanel.add(tIntervalLabel, gridBagConstraints);
                  gridBagConstraints = new GridBagConstraints();
                //1st Column
                   gridBagConstraints.gridx = 0;
                //2nd Row
                   gridBagConstraints.gridy = 1;
                //Stuck to the Right of the Column
                   gridBagConstraints.anchor = GridBagConstraints.EAST;
                trackPanel.add(xScaleLabel, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                //2nd Column
                   gridBagConstraints.gridx = 1;
                //2nd Row
                   gridBagConstraints.gridy = 1;
                //Stuck to the Left of the Column
                   gridBagConstraints.anchor = GridBagConstraints.WEST;
                trackPanel.add(xScale, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 0;
                   gridBagConstraints.gridy = 2;
                   gridBagConstraints.anchor = GridBagConstraints.EAST;
                trackPanel.add(yScaleLabel, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 1;
                   gridBagConstraints.gridy = 2;
                trackPanel.add(yScale, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 2;
                   gridBagConstraints.insets = new Insets(0, 10, 0, 0);
                trackPanel.add(tInterval, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 2;
                   gridBagConstraints.insets = new Insets(0, 10, 0, 0);
                trackPanel.add(tInterval, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 3;
                   gridBagConstraints.gridy = 1;
                   gridBagConstraints.anchor = GridBagConstraints.WEST;
                trackPanel.add(timeUnitLabel, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                //1st Column
                   gridBagConstraints.gridx = 0;
                //4th Row
                   gridBagConstraints.gridy = 3;
                //10 empty pixels on top of the Component
                   gridBagConstraints.insets = new Insets(10, 0, 0, 0);
                trackPanel.add(maxDifLabel, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 1;
                   gridBagConstraints.gridy = 3;
                   gridBagConstraints.insets = new Insets(10, 0, 0, 0);
                trackPanel.add(maxDif, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 0;
                   gridBagConstraints.gridy = 4;
                   gridBagConstraints.anchor = GridBagConstraints.EAST;
                trackPanel.add(minTrackLabel, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 1;
                   gridBagConstraints.gridy = 4;
                trackPanel.add(minTrack, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridx = 2;
                   gridBagConstraints.gridy = 3;
                   gridBagConstraints.gridwidth = 2;
                   gridBagConstraints.insets = new Insets(0, 5, 0, 0);
                trackPanel.add(difCoefLabel, gridBagConstraints);
                gridBagConstraints = new GridBagConstraints();
                   gridBagConstraints.gridy = 4;
                   gridBagConstraints.gridwidth = 2;
                   gridBagConstraints.insets = new Insets(0, 0, 5, 0);
                trackPanel.add(difCoef, gridBagConstraints);
                trackTabPanel = new JTabbedPane();
                trackTabPanel.addTab("Masking", maskPanel);
                trackTabPanel.addTab("Tracking", trackPanel);
         private void buildWindow() {
                Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
                setResizable(true);
                setTitle("Tracking");
                setVisible(true);
                getContentPane().add(trackTabPanel, BorderLayout.CENTER);
                setBounds(10, 10, 280, 180);
                addComponentListener(new ComponentAdapter () {
                                              public void componentMoved(ComponentEvent evt) {
                                                   Component c = (Component)evt.getSource();
                                                   c.repaint();
         private void setIcon() {
         public void actionPerformed(ActionEvent evt) {
         public void savePreferences(Properties prefs) {
                prefs.put("multiplier", multiplier.getText());
                prefs.put("threshold", threshold.getText());
                prefs.put("dilate2x", (dilate2.isSelected())?"true":"false");
                prefs.put("particleBK", (partBK.isSelected())?"true":"false");
                prefs.put("minPartSize", minPartSize.getText());
                prefs.put("xScale", xScale.getText());
                prefs.put("yScale", yScale.getText());
                prefs.put("tInterval", tInterval.getText());
                prefs.put("maxDif", maxDif.getText());
                prefs.put("minTrack", minTrack.getText());
                prefs.put("difCoef", difCoef.getText());
         public void setScale (double value,String unit) {
         public static void main(String[] args) {
              JFrame mFrame = new JFrame();
              JDesktopPane jdp = new JDesktopPane();
              trackWindow2 tw = new trackWindow2();
              jdp.add(tw);
              mFrame.setContentPane(jdp);
              mFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              mFrame.setSize(new Dimension(300,250));
              mFrame.setVisible(true);
    }

  • How to create the Sap script & Layout Set (wants sample code)

    Hi All ,
    Can you please provide me the step by step procedure
    to create the Sap script & Layout Set .(please provide sample
    code/links /docs for layout & print program).
    Regards
    Rahul

    hi,
    go through the following links  what i found to create sap script.
    http://www.thespot4sap.com/Articles/SAPscript_Introduction.asp
    http://abapliveinfo.blogspot.com/2008/01/free-sapscript-made-easy-46-book.html
    http://www.thespot4sap.com/articles/SAPscript_example_code.asp
    http://idocs.de/www3/cookbooks/sapscript/sapscript_1/docu.htm
    http://idocguru.com/www5/cookbooks/sapscript/sapscript_1/example.htm
    www.geocities.com/wardaguilar25/sapscript-tutorial.html
    http://logosworld.de/www3/cookbooks/sapscript/sapscript_8/docu.htm
    how to create a  scripts?give steps?
    https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=2969311
    https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=2902391
    https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=3205653
    https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=3111402
    http://www.sap-img.com/sapscripts.htm
    http://sappoint.com/abap/
    http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm
    http://help.sap.com/saphelp_crm40/helpdata/en/16/c832857cc111d686e0000086568e5f/content.htm
    http://www.sap-basis-abap.com/sapabap01.htm
    http://www.sap-img.com/sapscripts.htm
    http://searchsap.techtarget.com/tip/1,289483,sid21_gci943419,00.html
    http://sap.ittoolbox.com/topics/t.asp?t=303&p=452&h2=452&h1=303
    http://www.sapgenie.com/phpBB2/viewtopic.php?t=14007&sid=09eec5147a0dbeee1b5edd21af8ebc6a
    Other Links

Maybe you are looking for

  • SAP oops documets required

    SAP oops documets required

  • 9.0.1 stops in Vista

    Installed the latest version of iTunes on my iMac under Windows Vista. Database was converted and the I got the message that iTunes has stopped: Error info is as follows: Problem signature: Problem Event Name: APPCRASH Application Name: iTunes.exe Ap

  • Flush in the jsp:include tag

    should I state flush="true" every time I include a jsp using <jsp:include> tag in a jsp pages? For example I am trying to include a menu bar on the top of every jsp pages. Should I flush the buffer every time? if not, will it affect the performance?

  • Access Exporter Error

    Hi, when I try to do a Export for Application Express using Oracle Access Exporter 10.2.0.1.0 I get the following error: Error #29074 - XMLExporter - Method of 'Run' object '_Application' failed C:\Documents and Settings\Oracle.XP_ONE\Desktop\teste.m

  • I can't open Elements after I download it from the website.

    I recently had to replace my hard drive on my iMac. After doing so, I tried to download Photoshop Elements after logging into the Adobe website. I download and when I hit the "open" button, nothing happens. Does anybody have any insight on how to fix