JScrollPane containing JPanel HELP!

Hi again,
I'll try my luck again!
Ok, I have a JPanel that uses a GridBagLayout with 3 columns and many rows. Each row is of the form:
[JLabel][JTextField][JButton]
Ok. Since I have many of these rows, and my application should be a constant size, I need to somehow make you able to scroll down the list of these labels,textfields and buttons - to the one you want. I have tried making the containing JPanel the viewport of a JScrollPane, however, when I only have a couple of rows of labels, textfields, and buttons, each expands to fit the viewport size - and they turn out looking really dumb.
How can I get it so that the labels, textfields and buttons are only the height of the text in each?
Please please, please, please help me.
sincerely, Edd.

Chenge the weight (x&y) in the GridBagConstraints of the components you don't want to expand to 0.0. Change the fill to GridBagConstraints.NONE.

Similar Messages

  • JScrollpane and JPanel help

    i have a panel which is bigger than the main window's size. i want to add it onto the ScrollPane. but the scrollbar is not working. how do i refresh the scrollbar so that the scrollbar comes when the JPanel is attached onto it.

    the full code is
    public EditorPanel(int flag,String title,EditorFrame ed)
    Toolkit tk=Toolkit.getDefaultToolkit();
    clipBoard=tk.getSystemClipboard();
    write = new JTextPane();
    fileFlag=flag;
    fileName=title;
    edf=ed;
    EditorKit editorKit = new StyledEditorKit()     
    public Document createDefaultDocument()     
    {return new ColorSyntax();
    searchIndex=0;
         // creating the toolbar          
         toolBar=new JToolBar();
         addButtons(toolBar);
         toolBar.setBorder(new SoftBevelBorder(BevelBorder.RAISED));
         toolBar.setFloatable(false);
         toolBar.setBounds(0, 0, 800, 20);
         write.setEditorKitForContentType("text/8085", editorKit);
         write.setContentType("text/8085");
         write.replaceSelection("");
         write.requestFocus();
         write.addKeyListener(this);
         write.registerKeyboardAction(edf.getUndoAction(),KeyStroke.getKeyStroke,KeyEvent.VK_Z,InputEvent.CTRL_MASK),JComponent.WHEN_IN_FOCUSED_WINDOW);
         write.registerKeyboardAction(edf.getRedoAction(),KeyStroke.getKeyStroke(KeyEvent.VK_Y,InputEvent.CTRL_MASK),JComponent.WHEN_IN_FOCUSED_WINDOW);
         Dimension d=tk.getScreenSize();
         StyledDocument styledDoc = write.getStyledDocument();
         AbstractDocument doc = (AbstractDocument)styledDoc;
         doc.addUndoableEditListener(new MyUndoableEditListener());
    //problem is here
         scrollpane = new JScrollPane(write);          
         scrollpane.setPreferredSize(new Dimension((2*d.width)/3 - 15,3*d.height/4));
         scrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
         // making the object of the device panel to be added onto the device scroller
         devAddPanel =new DeviceAddPanel();
         deviceScrollpane = new JScrollPane();
         deviceScrollpane.setViewportView(devAddPanel);
         deviceScrollpane.setPreferredSize(new Dimension((d.width)/3 - 15,3*d.height/4));
         deviceScrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
         add(toolBar, BorderLayout.PAGE_START);
         //Create a split pane with the two scroll panes in it.
         splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,deviceScrollpane,scrollpane);
         splitPane.setOneTouchExpandable(true);
         splitPane.setDividerLocation(((d.width)/3)-5);
         splitPane.setContinuousLayout(true);
         splitPane.setDividerSize(15);
         add(splitPane, BorderLayout.CENTER);
    //problem ends here
    i am creating a split pane in which on the left i am adding the device panel which is giving the problem even though the panel is bigger that the scrollpane's size it is not showing the vertical scrollbar. the right side with the text area is working fine

  • Jsp  load Javabean contains jpanel

    how do i load login ( jpaneled gui ) bean in JSP. pls give me any example code
    login bean contains jpanel, jlabel, jtextfield, jpasswordfield, jbutton

    Not a assignment. i have login jpanel and i want to place in jsp page. Pls let me know how can i place javax components in jsp. help on this

  • JScrollPane bars problem Help!!!

    There is some problem with my JScrollPane
    I have added components to the JScrollPane but when components exceeds thee size of the JScrollPane the bars of the JScrollPane are not appearing. Please somebody help me... Just drag the JFrame and increase and decrease its size you will understand my problem. i cant see the remaining components because of no scroll bar.
    Here is a working code...
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import javax.swing.*;
    public class test2 extends JFrame implements ActionListener
         JPanel mypanes = new JPanel();     
         //Main Heading 1
         JPanel p1 = new JPanel();     
         JLabel l1 = new JLabel("MEDICINE INFORMATION");
         //Medicine General Information
         JPanel genpane = new JPanel();
         JLabel genl1 = new JLabel("General Information ");     
                   //MGI (1)
                   JPanel genpane1 = new JPanel();
                   JLabel nam = new JLabel("Name:");
                   JTextField gentf1 = new JTextField(14);               
                   JLabel genname = new JLabel("Name:");
                   JTextField gen1tf1 = new JTextField(14);
                   //MGI (2)
                   JPanel genpane2 = new JPanel();
                   JLabel genname1 = new JLabel("Generic Name:");
                   JTextField gen2tf2 = new JTextField(14);
                   //MGI (3)
                   JPanel genpane3 = new JPanel();
                   JLabel genname2 = new JLabel("Manufacturers Name:");
                   JTextField gen3tf3 = new JTextField(14);
                   //MGI (4)
                   JPanel genpane4 = new JPanel();
                   JLabel genname3 = new JLabel("Classification:");
                   JTextField gen4tf4 = new JTextField(14);
                   //MGI (6)
                   JPanel genpane5 = new JPanel();
                   JLabel genname4 = new JLabel("Prescription Required:");
                   JComboBox gen5tf5 = new JComboBox();
                   //Medicine Detailed Information
                   JPanel detpane = new JPanel();
                   JPanel detp2 = new JPanel();
                   JLabel detl1 = new JLabel("Detailed Information");
                   //MDI (1)
                   JPanel detpane1 = new JPanel();
                   //MDI (2)
                   JPanel detpane2 = new JPanel();
                   JLabel detl3 = new JLabel("Common Uses:");
                   //MDI (3)
                   JPanel detpane3 = new JPanel();
                   JTextArea dettf2 = new JTextArea(8,68);
         public test2(String title)
              super(title);
              //Main Heading Panel
              p1.setLayout(new GridLayout(3,3));
              p1.setBackground(Color.white);
              p1.add(new JLabel(""));                    
              p1.add(new JLabel(""));                    
              p1.add(new JLabel(""));                              
              p1.add(new JLabel(""));                    
              l1.setFont(new Font("avant garde bk bt",Font.BOLD,20));
              p1.add(l1);          
              p1.add(new JLabel(""));
              p1.add(new JLabel(""));                    
              p1.add(new JLabel(""));                    
              p1.add(new JLabel(""));     
                   //General Information
              genpane.setLayout(new GridLayout(10,1));
              genl1.setFont(new Font("TimesNewRoman",Font.PLAIN,20));
              genpane.add(genl1);
                   //MGI (1)
                   genpane1.setBackground(Color.white);
                   genpane1.setLayout(new GridLayout(1,5));
                   genpane1.add(new JLabel(""));
                   genpane1.add(new JLabel(""));
                   genpane1.add(new JLabel(""));               
                   genpane1.add(new JLabel(""));     
                   genpane1.add(new JLabel(""));     
                   //MGI (2)
                   genpane2.setBackground(Color.white);
                   genpane2.setLayout(new GridLayout(1,5));
                   genpane2.add(nam);
                   genpane2.add(gentf1);
                   genpane2.add(new JLabel(""));
                   genpane2.add(new JLabel(""));
                   genpane2.add(new JLabel(""));
                   //MGI (3)     
                   genpane3.setBackground(Color.white);
                   genpane3.setLayout(new GridLayout(1,5));
                   genpane3.add(genname1);
                   genpane3.add(gen2tf2);
                   genpane3.add(new JLabel(""));
                   genpane3.add(new JLabel(""));
                   genpane3.add(new JLabel(""));
                   //MGI (4)     
                   genpane4.setBackground(Color.white);
                   genpane4.setLayout(new GridLayout(1,5));
                   genpane4.add(genname2);
                   genpane4.add(gen3tf3);
                   genpane4.add(new JLabel(""));
                   genpane4.add(new JLabel(""));
                   genpane4.add(new JLabel(""));
                   //MGI (5)
                   genpane5.setBackground(Color.white);
                   genpane5.setLayout(new GridLayout(1,5));
                   genpane5.add(genname4);
                   genpane5.add(gen5tf5);
                   genpane5.add(new JLabel(""));
                   genpane5.add(new JLabel(""));
                   genpane5.add(new JLabel(""));               
                   //Medicine Detailed Information               
                   detpane.setLayout(new GridLayout(1,1));
                   detl1.setFont(new Font("TimesNewRoman",Font.PLAIN,20));
                   detpane.add(detl1);                         
                   //MDI(1)
                   detpane1.setBackground(Color.white);
                   detpane1.setLayout(new GridLayout(1,5));
                   detpane1.add(new JLabel(""));
                   detpane1.add(new JLabel(""));
                   detpane1.add(new JLabel(""));
                   detpane1.add(new JLabel(""));
                   detpane1.add(new JLabel(""));
                   //MDI(2)
                   detpane2.setBackground(Color.white);
                   detpane2.setLayout(new GridLayout(1,1));               
                   detpane2.add(detl3);
                   //MDI(3)
                   detpane3.setLayout(new GridLayout(1,1));
                   detpane3.add(dettf2);
                   //Adding Heading 2
                   detp2.setBackground(Color.white);
                   detp2.setLayout(new GridLayout(1,1));     
                   detp2.add(new JLabel(""));               
                   //Adding Panels to the Main JPanel i-e genpane
                   genpane.add(genpane1);
                   genpane.add(genpane2);
                   genpane.add(genpane3);
                   genpane.add(genpane4);
                   genpane.add(genpane5);
                   genpane.add(detp2);
                   genpane.add(detpane);
                   genpane.add(detpane1);                                        
                   genpane.add(detpane2);
                   gen5tf5.addItem("Yes");
                   gen5tf5.addItem("No");                    
                   JScrollPane spp = new JScrollPane(genpane);
                   spp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
                   spp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
         mypanes.setBackground(Color.white);
         mypanes.add(p1);
         mypanes.add(spp);
         setContentPane(mypanes);
         public void actionPerformed(ActionEvent ae)
         public static void main(String args[])
              test2 t = new test2("Title");
              t.setSize(800,300);
              t.setVisible(true);

    When you post code, please use [code] and [/code] tags as described in Formatting Help on the message entry page. It makes it much easier to read.

  • JPanel help

    hey,
    I'm making a calculator program with a function graphing part using JFrame and JPanel. But these two have been causing problems because when I run the GraphMain class, only a portion of the graph shows up. I have tested the Main and Graph classes and they work but the problem is the GraphMain class. Could somebody please help. here are the three classes:
    import java.util.Scanner;
    import java.util.ArrayList;
    //"Parentheses, Exponents, Multiplication and Division, and Addition and Subtraction"
    //NEED TO HANDLE NEGATIVE NUMBERS AND DIFFERENCE BETWEEN MINUS
    //RECURSIVE SOLVE DOESN'T WORK FOR INPUT WITH TWO SET PARENTHESIS EX. (1+56)(3/8)
    public class Main
         public static ArrayList<Character> symbols;
         public static double lastAnswer;
         public static boolean radians;
         public static void main(String[] args)
              //initialize recognized symbols
              symbols = new ArrayList<Character>();
              symbols.add('+');
              symbols.add('~');
              symbols.add('*');
              symbols.add('/');
              symbols.add('%');
              symbols.add('^');
              symbols.add('s');
              symbols.add('c');
              symbols.add('t');
              symbols.add('l');
              radians = true;
              Scanner in = new Scanner(System.in);
              System.out.println("CALCULATOR (h for help)");
              System.out.println("NOTE: ~ represents minus, - represents negative");
              String input = "";
              input = clearWhitespace(in.nextLine());
              while (!input.equalsIgnoreCase("q"))
                   if (input.equalsIgnoreCase("graph"))
                        System.out.println("Opening function graphing window...");
                   if (input.equalsIgnoreCase("h"))
                        System.out.println("\nVARIABLES");
                        System.out.println("ans = last answer");
                        System.out.println("@ = pi = 3.14...");
                        System.out.println("# = e = 2.718...");
                        System.out.println("\nKEYS");
                        System.out.println("h = help");
                        System.out.println("q = quit");
                        System.out.println("* = multiply");
                        System.out.println("~ = subtract");
                        System.out.println("+ = add");
                        System.out.println("/ = divide");
                        System.out.println("% = modulus");
                        System.out.println("sin = sine");
                        System.out.println("cos = cosine");
                        System.out.println("tan = tangent");
                        System.out.println("csc = cosecant");
                        System.out.println("sec = cosecant");
                        System.out.println("cot = cotangent");
                        System.out.println("asin = sine inverse");
                        System.out.println("acos = cosine inverse");
                        System.out.println("atan = tangent inverse");
                        System.out.println("acsc = cosecant inverse");
                        System.out.println("asec = cosecant inverse");
                        System.out.println("acot = cotangent inverse");
                        System.out.println("log = logarithm");
                        System.out.println("ln = natural logarithm");
                        System.out.println("() = solve first");
                        System.out.println("ENTER = solve");
                        System.out.println("\nFUNCTIONS");
                        System.out.println("checkDiagnostics");
                        System.out.println("enableRadians");
                        System.out.println("enableDegrees\n");
                   else if (diagnostics(input) != null)
                        System.out.println(diagnostics(input));
                   else if (!input.equals(""))
                        try
                             System.out.println("= " + solve(replaceVariables(input)));
                        catch (IllegalArgumentException ex)
                             System.out.println(ex.getMessage());
                   input = clearWhitespace(in.nextLine());
              /*String blah = "(415(645(2762+4)2524)4256465)";
              String la = blah.substring(findParenthesis(blah)[0], findParenthesis(blah)[1]);
              System.out.println(la);*/
              /*String gah = "2+7*356*7+6+23*34";
              gah = multiplyDivide(gah);
              gah = addSubtract(gah);
              System.out.println(gah);*/
              /*int i = 1;
              System.out.println(findNums(gah, i)[0]);
              System.out.println(findNums(gah, i)[1]);
              System.out.println(gah.substring(findNums(gah, i)[0], i));
              System.out.println(gah.substring(i + 1, findNums(gah, i)[1]));*/
              /*String foo = "2^2";
              foo = exponents(foo);
              System.out.println(foo);*/
              /*String boo = "2sin~";
              boo = replaceVariables(boo);
              boo = trigonometry(boo);
              System.out.println(boo);*/
              /*String lala = "2546(23(4)2)24562";
              System.out.println(lala.substring(findParenthesis(lala)[0] + 1, findParenthesis(lala)[1]));
              System.out.println(lala.substring(0, findParenthesis(lala)[0]));*/
              /*int q = 1000000;
              double[] ys = new double[q];
              for (int i = 1; i < q; i++)
                   ys[i] = Double.parseDouble(solve("sin(" + i + ")^(cos" + i + ")"));
              System.out.println("DONE");*/
              //about 41 seconds
              //System.out.println(solveFunctionOfX("x^2", 3));
         public static String solve(String theInput) throws IllegalArgumentException
              String input = theInput;
              int first = 0, last = 0;
              try
                   first = findParenthesis(input)[0];
                   last = findParenthesis(input)[1];
              catch (IllegalArgumentException ex)
                   throw ex;
              String replace = "";
              String temp = "";
              while (first != -1 && last != -1)
                   replace = solve(input.substring(first + 1, last));
                   temp = "";
                   if (first != 0)
                        temp += input.substring(0, first);
                   if (first - 1 >= 0 && Character.isDigit(input.charAt(first - 1)))
                        temp += "*";
                   temp += replace;
                   if (last + 1 < input.length() && (Character.isDigit(input.charAt(last + 1)) || input.charAt(last + 1) == '-'))
                        temp += "*";
                   if (last != input.length() - 1)
                        temp += input.substring(last + 1, input.length());
                   input = temp;
                   first = findParenthesis(input)[0];
                   last = findParenthesis(input)[1];
              try
                   input = fourLetterFunctions(input);
                   input = threeLetterFunctions(input);
                   input = twoLetterFunctions(input);
                   input = exponents(input);
                   input = multiplyDivide(input);
                   input = addSubtract(input);
                   lastAnswer = Double.parseDouble(input);
              catch (IllegalArgumentException ex)
                   throw ex;
              return input;
         public static double solveFunctionOfX(String input, double x)
              String solveFunction = "", solution = "";
              for (int i = 0; i < input.length(); i++)
                   if (input.charAt(i) == 'x')
                        solveFunction += x;
                   else
                        solveFunction += input.charAt(i);
              try
                   solution = solve(solveFunction);
              catch (IllegalArgumentException ex)
                   return 0;
              return Double.parseDouble(solution);
         public static String clearWhitespace(String input)
              String result = "";
              for (int i = 0; i < input.length(); i++)
                   if (!Character.isWhitespace(input.charAt(i)))
                        result += input.substring(i, i+1);
              return result;
         public static int[] findParenthesis(String input)
              int count = 0;
              int first = -1, last = -1;
              for (int i = 0; i < input.length(); i++)
                   if (input.charAt(i) == '(')
                        if (count == 0)
                             first = i;
                        count++;
                   else if (input.charAt(i) == ')')
                        count--;
                        if (count == 0)
                             last = i;
              if (count > 0)
                   throw new IllegalArgumentException("Missing Right Parenthesis");
              else if (count < 0)
                   throw new IllegalArgumentException("Missing Left Parenthesis");
              return new int[]{first, last};
         public static String addSubtract(String theInput)
              int j, k;
              double a, b, solution = 0;
              String temp = "", input = theInput;
              for (int i = 0; i < input.length(); i++)
                   if (input.charAt(i) == '+' || input.charAt(i) == '~')
                        j = findNums(input, i)[0];
                        k = findNums(input, i)[1];
                        b = Double.parseDouble(input.substring(i + 1, k));
                        if (i == 0)
                             if (input.charAt(i) == '+')
                                  solution = lastAnswer + b;
                             else if (input.charAt(i) == '~')
                                  solution = lastAnswer - b;
                        else
                             a = Double.parseDouble(input.substring(j, i));
                             if (input.charAt(i) == '+')
                                  solution = a + b;
                             else if (input.charAt(i) == '~')
                                  solution = a - b;
                        if (i != 0)
                             temp = input.substring(0, j);
                        temp += solution + input.substring(k, input.length());
                        input = temp;
                        i = 0;
              return input;
         public static String multiplyDivide(String theInput)
              int j, k;
              double a = 0, b = 0, solution = 0;
              String temp = "", input = theInput;
              for (int i = 0; i < input.length(); i++)
                   if (input.charAt(i) == '*' || input.charAt(i) == '/' || input.charAt(i) == '%')
                        j = findNums(input, i)[0];
                        k = findNums(input, i)[1];
                        b = Double.parseDouble(input.substring(i + 1, k));
                        if (i == 0)
                             if (input.charAt(i) == '*')
                                  solution = lastAnswer * b;
                             else if (input.charAt(i) == '/')
                                  if (b == 0)
                                       throw new IllegalArgumentException("Divide by Zero Error");
                                  solution = lastAnswer / b;
                             else if (input.charAt(i) == '%')
                                  solution = lastAnswer % b;
                        else
                             a = Double.parseDouble(input.substring(j, i));
                             if (input.charAt(i) == '*')
                                  solution = a * b;
                             else if (input.charAt(i) == '/')
                                  if (b == 0)
                                       throw new IllegalArgumentException("Divide by Zero Error");
                                  solution = a / b;
                             else if (input.charAt(i) == '%')
                                  solution = a % b;
                        if (i != 0)
                             temp = input.substring(0, j);
                        temp += solution + input.substring(k, input.length());
                        input = temp;
                        i = 0;
              return input;
         public static String exponents(String theInput)
              int j, k;
              double a, b, solution = 0;
              String temp = "", input = theInput;
              for (int i = 0; i < input.length(); i++)
                   if (input.charAt(i) == '^')
                        j = findNums(input, i)[0];
                        k = findNums(input, i)[1];
                        b = Double.parseDouble(input.substring(i + 1, k));
                        if (i == 0)
                             if (input.charAt(i) == '^')
                                  solution = Math.pow(lastAnswer, b);
                        else
                             a = Double.parseDouble(input.substring(j, i));
                             if (input.charAt(i) == '^')
                                  solution = Math.pow(a, b);
                        if (i != 0)
                             temp = input.substring(0, j);
                        temp += solution + input.substring(k, input.length());
                        input = temp;
                        i = 0;
              return input;
         public static String fourLetterFunctions(String theInput)
              int  k;
              double b, solution = 0;
              String temp = "", input = theInput;
              for (int i = 0; i < input.length() - 4; i++)
                   if (input.substring(i, i + 4).equals("asin") || input.substring(i, i + 4).equals("acos") || input.substring(i, i + 4).equals("atan") || input.substring(i, i + 4).equals("acsc") || input.substring(i, i + 4).equals("asec") || input.substring(i, i + 4).equals("acot"))
                        k = findNums(input, i + 3)[1];
                        b = Double.parseDouble(input.substring(i + 4, k));
                        //System.out.println(b);
                        if (input.substring(i, i + 4).equals("asin"))
                             if (Math.abs(b) > 1)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = (radians? Math.asin(b) : Math.asin(b) * 180 / Math.PI);
                        else if (input.substring(i, i + 4).equals("acos"))
                             if (Math.abs(b) > 1)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = (radians? Math.acos(b) : Math.acos(b) * 180 / Math.PI);
                        else if (input.substring(i, i + 4).equals("atan"))
                             solution = (radians? Math.atan(b) : Math.atan(b) * 180 / Math.PI);
                        else if (input.substring(i, i + 4).equals("acsc"))
                             if (Math.abs(b) < 1)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = (radians? Math.asin(1 / b) : Math.asin(1 / b) * 180 / Math.PI);
                        else if (input.substring(i, i + 4).equals("asec"))
                             if (Math.abs(b) < 1)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = (radians? Math.acos(1 / b) : Math.acos(1 / b) * 180 / Math.PI);
                        else if (input.substring(i, i + 4).equals("acot"))
                             solution = 1 / (radians? Math.atan(1 / b) : Math.atan(1 / b) * 180 / Math.PI);
                        //System.out.println(solution);
                        if (i != 0)
                             temp = input.substring(0, i);
                        if (i != 0 && Character.isDigit(input.charAt(i - 1)))
                             temp += "*";
                        temp += solution;
                        temp += input.substring(k, input.length());
                        input = temp;
                        //System.out.println(temp);
                        i = 0;
              return input;
         public static String threeLetterFunctions(String theInput)
              int  k;
              double b, solution = 0;
              String temp = "", input = theInput;
              for (int i = 0; i < input.length() - 3; i++)
                   if (input.substring(i, i + 3).equals("sin") || input.substring(i, i + 3).equals("cos") || input.substring(i, i + 3).equals("tan") || input.substring(i, i + 3).equals("log") || input.substring(i, i + 3).equals("csc") || input.substring(i, i + 3).equals("sec") || input.substring(i, i + 3).equals("cot"))
                        k = findNums(input, i + 2)[1];
                        b = Double.parseDouble(input.substring(i + 3, k));
                        //System.out.println(b);
                        if (input.substring(i, i + 3).equals("sin"))
                             solution = Math.sin((radians? b : b * 180 / Math.PI));
                        else if (input.substring(i, i + 3).equals("cos"))
                             solution = Math.cos((radians? b : b * 180 / Math.PI));
                        else if (input.substring(i, i + 3).equals("tan"))
                             if ((b + Math.PI / 2) % Math.PI == 0)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = Math.tan((radians? b : b * 180 / Math.PI));
                        else if (input.substring(i, i + 3).equals("log"))
                             if (b <= 0)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = Math.log10(b);
                        if (input.substring(i, i + 3).equals("csc"))
                             if (b % Math.PI == 0)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = 1 / Math.sin((radians? b : b * 180 / Math.PI));
                        else if (input.substring(i, i + 3).equals("sec"))
                             if ((b + Math.PI / 2) % Math.PI == 0)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = 1 / Math.cos((radians? b : b * 180 / Math.PI));
                        else if (input.substring(i, i + 3).equals("cot"))
                             if (b % Math.PI == 0)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = 1 / Math.tan((radians? b : b * 180 / Math.PI));
                        //System.out.println(solution);
                        if (i != 0)
                             temp = input.substring(0, i);
                        if (i != 0 && Character.isDigit(input.charAt(i - 1)))
                             temp += "*";
                        temp += solution;
                        temp += input.substring(k, input.length());
                        input = temp;
                        //System.out.println(temp);
                        i = 0;
              return input;
         public static String twoLetterFunctions(String theInput)
              int  k;
              double b, solution = 0;
              String temp = "", input = theInput;
              for (int i = 0; i < input.length() - 2; i++)
                   if (input.substring(i, i + 2).equals("ln"))
                        k = findNums(input, i + 1)[1];
                        b = Double.parseDouble(input.substring(i + 2, k));
                        //System.out.println(b);
                        if (input.substring(i, i + 2).equals("ln"))
                             if (b <= 0)
                                  throw new IllegalArgumentException("Out of Domain");
                             solution = Math.log(b);
                        //System.out.println(solution);
                        if (i != 0)
                             temp = input.substring(0, i);
                        if (i != 0 && Character.isDigit(input.charAt(i - 1)))
                             temp += "*";
                        temp += solution;
                        temp += input.substring(k, input.length());
                        input = temp;
                        //System.out.println(temp);
                        i = 0;
              return input;
         public static String replaceVariables(String theInput)
              String input = theInput;
              String temp = "";
              for (int i = 0; i < input.length(); i++)
                   if (input.charAt(i) == '#')
                        temp = input.substring(0, i);
                        if (i != 0 && Character.isDigit(input.charAt(i - 1)))
                             temp += "*";
                        temp += Math.E;
                        if (i != input.length() - 1 && (Character.isDigit(input.charAt(i + 1)) || input.charAt(i + 1) == '-'))
                             temp += "*";
                        temp += input.substring(i+1, input.length());
                        input = temp;
                   else if (input.charAt(i) == '@')
                        temp = input.substring(0, i);
                        if (i != 0 && Character.isDigit(input.charAt(i - 1)))
                             temp += "*";
                        temp += Math.PI;
                        if (i != input.length() - 1 && (Character.isDigit(input.charAt(i + 1)) || input.charAt(i + 1) == '-'))
                             temp += "*";
                        temp += input.substring(i+1, input.length());
                        input = temp;
                   else if (i < input.length() - 2 && input.substring(i, i + 3).equals("ans"))
                        temp = input.substring(0, i);
                        if (i != 0 && Character.isDigit(input.charAt(i - 1)))
                             temp += "*";
                        temp += lastAnswer;
                        if (i != input.length() - 3 && (Character.isDigit(input.charAt(i + 3)) || input.charAt(i + 3) == '-'))
                             temp += "*";
                        temp += input.substring(i+3, input.length());
                        input = temp;
              return input;
         public static int[] findNums(String input, int charPos)
              int k = charPos - 1, j = charPos + 1;
              while (k > 0 && (Character.isDigit(input.charAt(k - 1)) || input.charAt(k - 1) == 'E' || input.charAt(k - 1) == '.' || input.charAt(k - 1) == '-'))
                   k--;
              while(j < input.length() && (Character.isDigit(input.charAt(j)) || input.charAt(j) == 'E' || input.charAt(j) == '.' || input.charAt(j) == '-'))
                   j++;
              return new int[]{k,j};
         public static String diagnostics(String input)
              if (input.equals("checkDiagnostics"))
                   return "" + (radians? "radians":"degrees");
              else if (input.equalsIgnoreCase("radians?"))
                   return "" + radians;
              else if (input.equalsIgnoreCase("enabledegrees"))
                   radians = false;
                   return "done";
              else if (input.equalsIgnoreCase("enableradians"))
                   radians = true;
                   return "done";
              else
                   return null;
    import java.awt.Color;
    import java.awt.Graphics;
    public class Graph
         public Graph(int axMin, int axMax, int ayMin, int ayMax, int aappletSize)
              /*xSize = x;
              ySize = y;*/
              xMin = axMin;
              xMax = axMax;
              yMin = ayMin;
              yMax = ayMax;
              appletSize = aappletSize;
              xScaling = (double) appletSize/(Math.abs(xMin) + Math.abs(xMax));
              yScaling = (double) appletSize/(Math.abs(yMin) + Math.abs(yMax));
              //System.out.println(xScaling);
              //System.out.println(yScaling);
              rectCenterX = (xMin + xMax )/ 2;
              rectCenterY = (yMin + yMax) / 2;
              //System.out.println(rectCenterX);
              //System.out.println(rectCenterY);
              appletCenterX = (int)((appletSize / 2) - (rectCenterX * xScaling));
              appletCenterY = (int)((appletSize / 2) - (rectCenterY * yScaling));
              //System.out.println(appletCenterX);
              //System.out.println(appletCenterY);
              functions = new String[10];
              functionsBoolean = new boolean[10];
              functionSolutions = new double[10][appletSize];
              functionAppletSolutions = new int[10][appletSize];
              axis = true;
         public void drawGraph(Graphics g)
              drawAxis(g);
              drawFunctions(g);
         public void setFunction(int num, String function)
              functions[num] = function;
              solveFunctions(num);
         public void enableDisableFunction(int function, boolean state)
              functionsBoolean[function] = state;
         private void drawFunctions(Graphics g)
              for (int i = 0; i < 10; i++)
                   if (functionsBoolean)
                        g.setColor(colors[i]);
                        for (int j = 0; j < appletSize - 1; j++)
                             if ((functionAppletSolutions[i][j + 1] > 0 && functionAppletSolutions[i][j + 1] < appletSize) || (functionAppletSolutions[i][j] > 0 && functionAppletSolutions[i][j] < appletSize))
                                  g.drawLine(j, functionAppletSolutions[i][j], j + 1, functionAppletSolutions[i][j + 1]);
         private void solveFunctions(int i)
              for (int j = 0; j < appletSize; j++)
                   //System.out.println(convertToRectangular(j,0)[0]);
                   //System.out.println(functions.get(i));
                   //System.out.println(Main.solveFunctionOfX(functions.get(i), convertToRectangular(j,0)[0]));
                   functionSolutions[i][j] = Main.solveFunctionOfX(functions[i], convertToRectangular(j,0)[0]);
                   functionAppletSolutions[i][j] = convertToApplet(0, functionSolutions[i][j])[1];
         private double[] convertToRectangular(int appletX, int appletY)
              double newX = 0, newY = 0;
              newX = (double) ((appletX - appletCenterX) / xScaling);
              newY = (double) ((appletY - appletCenterY) / yScaling);
              return new double[]{newX, newY};
         private int[] convertToApplet(double x, double y)
              int newX = 0, newY = 0;
              newX = (int) (x * xScaling) + appletCenterX;
              newY = (int) (-y * yScaling) + appletCenterY;
              return new int[]{newX, newY};
         private void drawAxis(Graphics g)
              if (axis)
                   g.setColor(Color.black);
                   //x-axis
                   g.drawLine(0, appletCenterY, appletSize, appletCenterY);
                   //y-axis
                   g.drawLine(appletCenterX, 0, appletCenterX, appletSize);
         public void printSolutions(int functionNumber)
              for (int i = 0; i < appletSize; i++)
                   System.out.println(convertToRectangular(i,0)[0] + " | " + functionSolutions[functionNumber][i]);
         public void printAppletSolutions(int functionNumber)
              for (int i = 0; i < appletSize; i++)
                   System.out.println(i + " | " + functionAppletSolutions[functionNumber][i]);
         public void printFunctionsBoolean()
              for (int i = 0; i < functionsBoolean.length; i++)
                   System.out.println(i + " | " + functionsBoolean[i]);
         private boolean axis;
         private String[] functions;
         private double[][] functionSolutions;
         private int[][] functionAppletSolutions;
         private boolean[] functionsBoolean;
         private int xMin;
         private int xMax;
         private int yMin;
         private int yMax;
         private int appletSize;
         private double rectCenterX;
         private double rectCenterY;
         private int appletCenterX;
         private int appletCenterY;
         private double xScaling;
         private double yScaling;
         private static Color[] colors = new Color[]{Color.blue, Color.cyan, Color.green, Color.magenta, Color.orange, Color.pink, Color.red, Color.yellow, Color.gray, Color.darkGray};
    import java.awt.Container;
    import java.awt.Graphics;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ItemEvent;
    import java.awt.event.ItemListener;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JCheckBoxMenuItem;
    import javax.swing.JPanel;
    import javax.swing.JOptionPane;
    public class GraphMain implements ActionListener, ItemListener
         public JMenuBar createJMenuBar()
              JMenuBar menuBar = new JMenuBar();
              JMenu fileMenu = new JMenu("File");
              menuBar.add(fileMenu);
              JMenuItem exit = new JMenuItem("Exit");
              exit.addActionListener(this);
              fileMenu.add(exit);
              JMenu functionMenu = new JMenu("Function");
              menuBar.add(functionMenu);
              JMenu function1 = new JMenu("function 1");
              JMenuItem edit1 = new JMenuItem("edit 1");
              JCheckBoxMenuItem enable1 = new JCheckBoxMenuItem("enable 1");
              edit1.addActionListener(this);
              enable1.addItemListener(this);
              function1.add(edit1);
              function1.add(enable1);
              functionMenu.add(function1);
              JMenu function2 = new JMenu("function 2");
              JMenuItem edit2 = new JMenuItem("edit 2");
              JCheckBoxMenuItem enable2 = new JCheckBoxMenuItem("enable 2");
              edit2.addActionListener(this);
              enable2.addItemListener(this);
              function2.add(edit2);
              function2.add(enable2);
              functionMenu.add(function2);
              JMenu function3 = new JMenu("function 3");
              JMenuItem edit3 = new JMenuItem("edit 3");
              JCheckBoxMenuItem enable3 = new JCheckBoxMenuItem("enable 3");
              edit3.addActionListener(this);
              enable3.addItemListener(this);
              function3.add(edit3);
              function3.add(enable3);
              functionMenu.add(function3);
              JMenu function4 = new JMenu("function 4");
              JMenuItem edit4 = new JMenuItem("edit 4");
              JCheckBoxMenuItem enable4 = new JCheckBoxMenuItem("enable 4");
              edit4.addActionListener(this);
              enable4.addItemListener(this);
              function4.add(edit4);
              function4.add(enable4);
              functionMenu.add(function4);
              JMenu function5 = new JMenu("function 5");
              JMenuItem edit5 = new JMenuItem("edit 5");
              JCheckBoxMenuItem enable5 = new JCheckBoxMenuItem("enable 5");
              edit5.addActionListener(this);
              enable5.addItemListener(this);
              function5.add(edit5);
              function5.add(enable5);
              functionMenu.add(function5);
              JMenu function6 = new JMenu("function 6");
              JMenuItem edit6 = new JMenuItem("edit 6");
              JCheckBoxMenuItem enable6 = new JCheckBoxMenuItem("enable 6");
              edit6.addActionListener(this);
              enable6.addItemListener(this);
              function6.add(edit6);
              function6.add(enable6);
              functionMenu.add(function6);
              JMenu function7 = new JMenu("function 7");
              JMenuItem edit7 = new JMenuItem("edit 7");
              JCheckBoxMenuItem enable7 = new JCheckBoxMenuItem("enable 7");
              edit7.addActionListener(this);
              enable7.addItemListener(this);
              function7.add(edit7);
              function7.add(enable7);
              functionMenu.add(function7);
              JMenu function8 = new JMenu("function 8");
              JMenuItem edit8 = new JMenuItem("edit 8");
              JCheckBoxMenuItem enable8 = new JCheckBoxMenuItem("enable 8");
              edit8.addActionListener(this);
              enable8.addItemListener(this);
              function8.add(edit8);
              function8.add(enable8);
              functionMenu.add(function8);
              JMenu function9 = new JMenu("function 9");
              JMenuItem edit9 = new JMenuItem("edit 9");
              JCheckBoxMenuItem enable9 = new JCheckBoxMenuItem("enable 9");
              edit9.addActionListener(this);
              enable9.addItemListener(this);
              function9.add(edit9);
              function9.add(enable9);
              functionMenu.add(function9);
              JMenu function10 = new JMenu("function 10");
              JMenuItem edit10 = new JMenuItem("edit 10");
              JCheckBoxMenuItem enable10 = new JCheckBoxMenuItem("enable 10");
              edit10.addActionListener(this);
              enable10.addItemListener(this);
              function10.add(edit10);
              function10.add(enable10);
              functionMenu.add(function10);
              return menuBar;
         public Container createContentPane()
              JPanel contentPane = new JPanel()
                   public void run()
                        while (true)
                             repaint();
                   public void paintComponent(Graphics g)
                        //System.out.println(getWidth());
                        //System.out.println(getHeight());
                        graph.drawGraph(g);
                        //graph.printAppletSolutions(0);
              contentPane.setOpaque(true);
              return contentPane;
         public void actionPerformed(ActionEvent e)
              JMenuItem source = (JMenuItem) (e.getSource());
              String what = source.getText();
              if (what.equals("Exit"))
                   quit();
              else if (what.equals("edit 1"))
                   graph.setFunction(0, JOptionPane.showInputDialog(null, "Enter function 1."));
              else if (what.equals("edit 2"))
                   graph.setFunction(1, JOptionPane.showInputDialog(null, "Enter function 2."));
              else if (what.equals("edit 3"))
                   graph.setFunction(2, JOptionPane.showInputDialog(null, "Enter function 3."));
              else if (what.equals("edit 4"))
                   graph.setFunction(3, JOptionPane.showInputDialog(null, "Enter function 4."));
              else if (what.equals("edit 5"))
                   graph.setFunction(4, JOptionPane.showInputDialog(null, "Enter function 5."));
              else if (what.equals("edit 6"))
                   graph.setFunction(5, JOptionPane.showInputDialog(null, "Enter function 6."));
              else if (what.equals("edit 7"))
                   graph.setFunction(6, JOptionPane.showInputDialog(null, "Enter function 7."));
              else if (what.equals("edit 8"))
                   graph.setFunction(7, JOptionPane.showInputDialog(null, "Enter function 8."));
              else if (what.equals("edit 9"))
                   graph.setFunction(8, JOptionPane.showInputDialog(null, "Enter function 9."));
              else if (what.equals("edit 10"))
                   graph.setFunction(9, JOptionPane.showInputDialog(null, "Enter function 10."));
         public void itemStateChanged(ItemEvent e)
              JCheckBoxMenuItem source = (JCheckBoxMenuItem)(e.getSource());
    String what = source.getText();
    if (what.equals("enable 1"))
                   graph.enableDisableFunction(0, source.getState());
              else if (what.equals("enable 2"))
                   graph.enableDisableFunction(1, source.getState());
              else if (what.equals("enable 3"))
                   graph.enableDisableFunction(2, source.getState());
              else if (what.equals("enable 4"))
                   graph.enableDisableFunction(3, source.getState());
              else if (what.equals("enable 5"))
                   graph.enableDisableFunction(4, source.getState());
              else if (what.equals("enable 6"))
                   graph.enableDisableFunction(5, source.getState());
              else if (what.equals("enable 7"))
                   graph.enableDisableFunction(6, source.getState());
              else if (what.equals("enable 8"))
                   graph.enableDisableFunction(7, source.getState());
              else if (what.equals("enable 9"))
                   graph.enableDisableFunction(8, source.getState());
              else if (what.equals("enable 10"))
                   graph.enableDisableFunction(9, source.getState());
         protected void quit()
              System.exit(0);
         private static void createAndShowGUI()
              JFrame frame = new JFrame("Graph");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              GraphMain main = new GraphMain();
              frame.setJMenuBar(main.createJMenuBar());
              frame.setContentPane(main.createContentPane());
              frame.setSize(408, 457);
              /*GraphComponent component = new GraphComponent();
              frame.add(component);*/
              frame.setVisible(true);
         public static void main(String[] args)
              /*for (int i = 1; i <= 10; i++)
                   System.out.println("JMenu function" + i + " = new JMenu(function " + i + ");\n" +
                             "JMenuItem edit" + i + " = new JMenuItem(edit " + i + ");\n" +
                                       "JCheckBoxMenuItem enable" + i + " = new JCheckBoxMenuItem(enable " + i + ");\n" +
                                                 "edit" + i + ".addActionListener(this);\n" +
                                                 "enable" + i + ".addItemListener(this);\n" +
                                                 "function" + i + ".add(edit" + i + ");\n" +
                                                 "function" + i + ".add(enable" + i + ");\n" +
                                                 "functionMenu.add(function" + i + ");\n");
              graph = new Graph(-10, 10, -10, 10, 400);
              graph.setFunction(0, "x");
              graph.setFunction(1, "x^2");
              graph.setFunction(2, "x^3");
              graph.setFunction(3, "x^4");
              graph.setFunction(4, "x^5");
              graph.setFunction(5, "x^6");
              graph.setFunction(6, "x^7");
              graph.s

    If only the x-positive part of graph is showing up, check the behaviour of Math.pow
    when the first argument is negative. (I know you are trying to raise numbers to a
    positive integral power, but I have no idea what happens further up when you
    parse the expression.)

  • To insert JScrollPane in JPanel

    Hi! I have a problem, want to put a JScrollPane in a JPanel, since in the JPanel a graph shows itself and I wanted to be able to move towards the right when I exceed the JPanel, but I put:
    scroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    add( scroll,BorderLayout.CENTER );
    But does not it(he,she) appear, podeis to help myself? Thank you

    Hello again, I feel it but I do not understand you well. This uses but I do not work either, some another idea? Thank you
    calculo = new CalculoPanel(this,lanza);
    scroll = new JScrollPane(calculo);                    
    add(scroll, BorderLayout.CENTER);
    jpnInferior = new JPanel(gblInformacion);
    containerPanel.add("South",jpnInferior);
    jpnInferior.add(calculo,gbcInformacion);
    Message was edited by:
    agsim

  • JScrollPane in JPanel???

    Hi !!!
    I want to add a JScrollPane to a JPanel, but it's doesn't work.
    class Planche extends JPanel
    JFrame f;
    public Planche(JFrame f)
    this.f = f;
    this.setLayout(null);
    JPanel p_tousGraphique = new JPanel();
    p_tousGraphique.setLayout(null);
    JScrollPane scrollPane = new JScrollPane(p_tousGraphique, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    p_tousGraphique.setBounds(10,10,1800,1600);
    this.add(scrollPane);
    Thanks by advance!!!

    Thanks for your answer, it's help to find the solution. The script display the scrollpane in the panel. But I have a problem. I want to put some componement in the jpanel and I do disable the layour manager
    p_tousGraphique.setLayout(null);
    But when I remove this line the scrollbar work fine, but my componement doesn't display like I want. So I disable the layour manager. The scrollbar display in jpanel but it doesn't scroll, dispite I have some componement that I don't see in my eye.
    Thanks by advance !!!
    My script that I do:
    this.setLayout(new BorderLayout());
    p_tousGraphique.setLayout(null);
    JScrollPane scrollPane = new JScrollPane(p_tousGraphique, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollPane.setPreferredSize(new Dimension(p_tousGraphique.getWidth(),p_tousGraphique.getHeight()));
    this.add(scrollPane);
    this is my principale JPanel

  • Set text of container - javascript help, please!

    I have used Dreamweaver behaviours to "Set text of container" and make different writing appear inside a box when I click a hotspot. Now I want people to be able to click on the writing that just appeared and make more text appear in another box. Could someone tell me how to do this? I don't think I can use Dreamweaver's behaviours for this because there's no material trigger... in that the writing that is the trigger only appears when the first trigger is clicked, but I'm more than happy to be corrected!!
    So, I've been trawling through javascript libraries but I don't know what I'm doing, so if someone could either tell me how to do this in dreamweaver or really spell out what libraries etc. I need to download and what code I need to make a bit of text that's already a set text of a container into a trigger for a set text of another container, that would be great!
    Sorry for the complicated question, it's difficult to explain what I mean.
    All help very much appreciated ^^

    flozzle19262010 wrote:
    I... really don't see how that will help you, considering I'm just asking HOW to do something. It's not like there's a mistake in my CSS or whatever, I just want to know if such a thing as described above is possible...
    As I say, I'm reluctant to upload it as it's for someone else.
    Have a look here http://forums.adobe.com/message/2691056#2691056.
    Both Nancy (one of the best in the business) and I have been trying to help. It's your call.
    I wish you the best of luck.
    Ben

  • Container (JPanel) refresh problem

    Hello,
    In fact i have a panel (mainPanel) with a button OK, a another panel which display a specific MyJTable and combo box.
    In fact, when I clic OK Button, i want to charge my MyJTable with data depends on comboBox.
    First, i display a empty white panel and when i clic Ok i want to display my MyJTable.
    JPanel mainPanel = new JPanel();
    JPanel emptyPanel = new JPanel();
    JPanel combo = new JComboBox();
    JButton okButton = new JButton();
    MyJTable myJTable;
    mainPanel.add(emptyPanel);
    mainPanel.add(combo);
    mainPanel.add(okButton);I have a refresh problem, i try mainPanel.remove(emptyPanel) and thus mainPanel.add(myJTable), the remove works but the add no :(
    In ActionPerformed method when okButton:
    myJTable = new myJTable(combo);
    mainPanel.remove(emptyPanel);
    mainPanel.add(myJTable);
    mainPanel.repaint();Thanks for yu help!!

    Hi,
    have you tried playing with
    mainPanel.revalidate();
    mainPanel.revalidate();??
    Might help
    Phil

  • Tabs are no longer loading, I have disabled addon's, killed the plugin-container, nothing helps

    Worked fine earlier this week. Now, the saved tabs (from session manager) just do not load. A few do but only 2-3 out of 16. I've disabled most addon's, stopped the plugin container, performed all MS updates for XP, downloaded 3.6.10 of Firefox, nothing helps. I give up.

    I solved the code problem myself after a careful run through of the code, the "else" in my subclass made it so that every button other than the Add button deleted a selected entry, i quickly fixed it and made it an if statement.
    Thank you for the link cotton.m
    My question bout optimizing still remains though:In the beginning of my code i have it loading the entire library with the *, and i noticed after turning it into a .jar that it loads slower than i expected... would a way to speed it up be to specify exactly what i need loaded after the program is finished or would it make no diffrence?

  • Swing (JScrollPane - scroll bar) help

    Hello all..
    I am new user in Swing. Currently I am developing a program using JSCrollPane. I have to draw a kind of chart in it. Therefore as a drawing media, I used the JPanel, in which I put it inside my JScrollPane. Then.. since my graphic is long.. then I set the
    setHorizontalScrollBarPolicy value to ALWAYS. Then I put my JPanel using the following commands :
    this.jScrollPane1.setViewportView(this.jPanel2);
    this.jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    Fyi, my JPanel size is set to be wider than the jScrollPane3 size. Nevertheless.. during the run time the horizontal scroll bar is not shown. I am completely loss on how to solve this. Does anyone has any clue or solution for this problem. Thank you very much in advance.
    Kariyage.

    Fyi, my JPanel size is set to be wider than the jScrollPane3 sizeYou should use panel.setPreferredSize(...) not panel.setSize(...);

  • Container manipulation help

    All,
    I need some help in designing this scenario. I do not have the luxury to write a custom BAPI. Here is my scenario. A typical async>sync>async with little modification
    1. Async call to BPM with input payload
    2. BPM calla BAPI_SALESORDER_GETLIST with customer number and sales organization from input payload and returns a list sales order items (Sync)
    3. I need to call the BAPI_SALESORDER_GETSTATUS for each sales order number that I got from the first call (Sync?). Not sure how this has to be designed
    4. Transfer the data through HTTP adapter (Async)
    I am able to perform step 1, 2 and 4 (of course only line item data). I need some pointer help on how to incorporate it in step 3 of BPM.
    I can use a block with foreach and call the BAPI_SALESORDER_GETSTATUS after the first sync call to GETLIST BAPI but I am struggling to convert the response from first BAPI call BAPI_SALESORDER_GETLIST which is a single line message type to multiline message type. In fact all I need is the list of sales order number from the first call and loop through it and call the status BAPI. How do I loop through the response and collect the order number into a container?

    Hi...
    By this time you must have resolve this query at your end..
    Can you plese share the solution used by you

  • JPanel help, i am so very noob

    hey, can someone help me with Jpanel, i want to make the JPanel like a gridlayout, does anyone know how? if not, can a Jframe have like a selfcontainedframe? (just wondering, i don't ecen know if that word exists, i know jpanel has a selfcontainedpanel or something)

    Maybe you want in Internal Frame:
    http://java.sun.com/docs/books/tutorial/uiswing/components/internalframe.html
    Take a look at the Table Of Contents from above. There is also a section on Layout Managers.

  • Dynamically resizing Knobs on JScrollPane when JPanel contents grows

    If I dynamically add components to a JPanel (causing it to grow in length e.g. Flowlayout) that is inside a JScrollPane how can I detect and adjust the JScrollPane knobs so that they show the complete JPanel.
    I know that if I set the JPanel's preferred size it will do this, but how do I know what this size is? I don't want to have to track the size of the components I am adding to the JPanel and work it all out manually, there must be an easier way to do it.

    I know that if I set the JPanel's preferred size it will do this
    there must be an easier way to do it. You should NOT be manually setting the preferred size, just let the layout manager calculate it.
    After adding components to the panel you just invoke:
    panel.revalidate();

  • DrawImage() on JPanel help...

    Hello folks,
    Im a student, working on a project involving drawing pictures on JPanels. (Specifically, its a board game that has 50 spaces and a player piece, which is a JPEG, must be drawn on the panel and moved around to different spaces with the mouse.)
    I have a big JPanel as the board, and then 50 smaller JPanels as the spaces on the board. As far as the mouse movement detection, Im sure I can use a mouseMotionListener on the board panel, and compare where the player clicked with the coordinates of the spaces on the board. However, I am having trouble figuring out how to draw an image on the board panel. It would probably be easier to make my own custom panel that extends JPanel, but Im too far into it to go back and redo all of that. My question is, how would I draw a JPEG on a regular JPanel? I know I need to use an imageIcon and drawImage(), specifying the picture I want drawn and the coordinates of where I would like it to go - however, Im not sure where I should put these method calls. I've tried for quite a while without any luck... so any help would be appreciated.
    Eric

    Maybe this thread will give you an idea:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=492100

Maybe you are looking for

  • Creative Cloud White Screen on Start-up.

    When I open my Adobe CC is brings me to a white screen only and will not allow me to pass it. I have tried to delete the OBEE file, Change the name of it, and completely reinstall CC 3-4 times with no success, im just bummed that I cant update any of

  • Business package to be deployed for ESS/MSS in EHP4 SP11

    Dear SAP Gurus, Please let me know if ESS/MSS is integrated with EHP4 or I will have to deploy these packages to implement ESS/MSS. I found from SDN that if ERP Stack is 16 and EHP4 SP 4 and SAP_APPL is 600 SP4 and EA_HR,SAP_HR at 604 11, we need XSS

  • How to use Swing Worker

    Hello, I have an exe file which is to be called from my program and it runs as seperate thread. The main purpose of this exe file is to create two files within the application directory. Next my program check to see if these files exists if these fil

  • Strange issue with Adobe Acrobat 8 Pro

    I have a user who has a very strange issue. When she clicks the acrobat pro shortcut, adobe reader launches. The target path of the shortcut is correct and even when I drill down through C: and program files all the way to acrobat.exe, reader launche

  • Cannot Start Copy of Notepad.exe

    Just to test security issues, I created a new path c:\bint\tests and copied Notepad.exe into this folder.   I gave ALL APPLICATION PACKAGES Read access to c:\bint and this inherits down the file tree. While logged in as an ordinary user, I am NOT abl