SOS: JPanel ... Help MEEEE!

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class jd extends JPanel implements ActionListener
     int R = 120;
     int T = 120;
     public void paintComponent(Graphics g)
     g.setColor(Color.RED);
     g.drawLine(50,50,R,T);
     g.drawLine(R,T,200,200);
     public void SetupPage()
     JFrame frame = new JFrame("Grrrr");
     frame.setLocationRelativeTo(null);
     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     frame.setSize(500,300);
     frame.getContentPane().setLayout(new BorderLayout());
     JButton j = new JButton("abcd");
     frame.add(j);
     j.addActionListener(this);
     frame.getContentPane().add(j, BorderLayout.NORTH);
     JPanel Graph = new jd();
     frame.getContentPane().add(Graph);
     //frame.getContentPane().add(Graph, BorderLayout.SOUTH);
     frame.setVisible(true);
     public static void main(String args[])
          jd J = new jd();
          J.SetupPage();
     public void actionPerformed(ActionEvent e)
                    R = 500;
                    T = 500;
          repaint();
I dont know why... the repaint never works.... and the initial line wont even show if i add the graph to the BorderLayout.SOUTH .. I have to set it to the contentPage ... I am confused.. Help me... Thanks in advance!

You should do the basic tutorials: http://java.sun.com/docs/books/tutorial/uiswing/
Try this code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Jd extends JPanel implements ActionListener{
  int r = 120;
  int t = 120;
  public void paintComponent(Graphics g){
    g.setColor(Color.RED);
    g.drawLine(50, 50, r, t);
    g.drawLine(r, t, 200, 200);
  public static void setupPage(){
    JFrame frame = new JFrame("Grrrr");
    frame.setLocationRelativeTo(null);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton j = new JButton("abcd");
    frame.getContentPane().add(j, BorderLayout.NORTH);
    Jd graph = new Jd();
    frame.getContentPane().add(graph, BorderLayout.CENTER);
    j.addActionListener(graph);
    frame.setSize(500, 500);
    frame.setVisible(true);
  public static void main(String args[]){
    setupPage();
  public void actionPerformed(ActionEvent e){
    r = 500;
    t = 500;
    repaint();
}

Similar Messages

  • How i can install my plugin in Logic X?! please help meeee :( i can't install all plugin in logic

    How i can install my plugins in Logic X?! please help meeee i can't install all plugins in logic....Logic is original

            4GB of RAM
    Display with 1280-by-768 resolution or higher
    OS X v10.8.4 or later
    Requires 64-bit Audio Units plug-ins
    Minimum 5GB of disk space. 35GB of optional content available via in-app download.

  • 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.)

  • 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.

  • 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.

  • 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

  • Please help meeee!! Problems with library and syncing on new laptop

    Hi I've bought a new laptop and want to start using itunes on the new one, however:
    Problem 1- Even though I've enabled both devices and have clicked on the home sharing, only the songs I have purchased from itunes show in my library and playlists (I managed to import my playlist titles by copying the file and emailing it to myself but it won't show songs other than those purchased from itunes) How can I get the library to show the 500 odd songs I've painstakingly spent importing to itunes on my old, slow laptop? If I have to do them all again I may just have a breakdown!!!
    Problem 2- Have imported a CD into itunes library using my new laptop but it won't show on my ipod after syncing it. I think I have enough space cos the bottom bar says 3.26 GB free!
    I'm really not very techie and don't use itunes much so there may be something glaringly obvious that I'm doing wrong. If anyone can help I'd really appreciate it
    Thanks
    Cheryl

    Home Sharing doesn't really matter, if you plan to stop using the old computer for iTunes.
    Apple has this document
    http://support.apple.com/kb/HT4527
    You should use the method titled External drive. If you use this method, you can ignore the rest of the document.
    The details are in the document, but to summarize this process (so that you have the "big picture" before reading the details)...
    You are copying your iTunes folder from the old laptop to the external drive, and then copying that iTunes folder from the external drive to the new laptop.  When you copy the iTunes folder to the new laptop, you are replacing the existing iTunes folder.  The next time you start up iTunes on the new laptop, it will use the iTunes folder from the old laptop, and it should look like iTunes running on the old laptop. 
    When you read through the document, it may be easier to understand if you keep my "overview" in mind. Please ask any questions you may have about the "details" in the document.
    NOTE:  If you have new songs on the new laptop that are not in your old laptop's iTunes library, you need to keep the existing iTunes folder on the new laptop.  After you have successfully transfered your iTunes folder from the old laptop to the new laptop, and everything is OK when you run iTunes on the new laptop, THEN add the new songs.  This is in the document. 
    You should put Problem 2 aside until the above is completed.

  • Locate a JPanel in an other JPanel (HELP !!!)

    I add the class affectation (see below) in a JPanel but I can't succeed in locating it in this JPanel..
    I have tried to use setLocate and setBounds but it doesn't work
    public class Affectation extends JPanel{
    public Affectation(int deb, int fin,Color couleur){
    this.setBackground(couleur);
    this.setBorder(BorderFactory.createLineBorder(Color.black));
    //this.setBounds(new Rectangle(deb,10,fin-deb,20));
    this.setLocation(deb, 7);
    this.setPreferredSize (new Dimension(fin-deb,20));
              this.setMinimumSize (new Dimension(fin-deb,20));
              this.setMaximumSize (new Dimension(fin-deb,20));
    }

    Here's an example that uses absolute positioning to get a drag effect:import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test extends JFrame {
        public Test () {
            Dimension sizeA = new Dimension (300, 300);
            Dimension sizeB = new Dimension (300, 300);
            DragPanel dragPanelA = new DragPanel (sizeA, new Rectangle (100, 100, 100, 100), Color.YELLOW);
            DragPanel dragPanelB = new DragPanel (sizeB, new Rectangle (100, 100, 100, 100), Color.GREEN);
            WrapPanel wrapPanelA = new WrapPanel (sizeA, dragPanelA, Color.GREEN);
            WrapPanel wrapPanelB = new WrapPanel (sizeB, dragPanelB, Color.YELLOW);
            getContentPane ().setLayout (new GridLayout (1, 2));
            getContentPane ().add (wrapPanelA);
            getContentPane ().add (wrapPanelB);
            setDefaultCloseOperation (DISPOSE_ON_CLOSE);
            setResizable (false);
            setTitle ("Drag those panels!");
            pack ();
            setLocationRelativeTo (null);
            show ();
        private class WrapPanel extends JPanel {
            private Dimension size;
            public WrapPanel (Dimension size, Component component, Color background) {
                this.size = size;
                setLayout (null);
                add (component);
                setBackground (background);
            public Dimension getPreferredSize () {
                return size;
        private class DragPanel extends JPanel {
            private Dimension outerSize;
            private Rectangle bounds;
            public DragPanel (Dimension outerSize, Rectangle bounds, Color background) {
                this.outerSize = outerSize;
                this.bounds = bounds;
                setBounds (bounds);
                setBackground (background);
                DragListener dragListener = new DragListener ();
                addMouseListener (dragListener);
                addMouseMotionListener (dragListener);
            private class DragListener implements MouseListener, MouseMotionListener {
                private Point previousPoint;
                public DragListener () {
                    previousPoint = null;
                public void mousePressed (MouseEvent event) {
                    previousPoint = event.getPoint ();
                public void mouseReleased (MouseEvent event) {
                    previousPoint = null;
                public void mouseDragged (MouseEvent event) {
                    Point point = event.getPoint ();
                    int dx = point.x - previousPoint.x;
                    int dy = point.y - previousPoint.y;
                    bounds.x = getBetween (bounds.x + dx, 0, outerSize.width - bounds.width);
                    bounds.y = getBetween (bounds.y + dy, 0, outerSize.height - bounds.height);
                    setBounds (bounds);
                private int getBetween (int value, int lower, int upper) {
                    return (value < lower) ? lower : (value > upper) ? upper : value;
                public void mouseClicked (MouseEvent event) {}
                public void mouseEntered (MouseEvent event) {}
                public void mouseExited (MouseEvent event) {}
                public void mouseMoved (MouseEvent event) {}
        public static void main (String[] parameters) {
            new Test ();
    }Alternatively, you could create a super wrap panel (or something similar) to place the wrap panels in.
    Kind regards,
      Levi

  • Javax.swing.JPanel Help

    my application is sort of a game, i planned on having a JPanel subclass called EventPanel have an instance variable _curPanel.
    curPanel is of type JPanel. In the constructor  I can set curPanel to Other JPanel subclasses. I have another subclass of JPanel called MainScreen, which has the main screen for the game.
    I can set curPanel = new MainScreen(); in the constructor for eventPanel. And it works.
    But if I try to change _curPanel after i've made it, it wont show up. I have a method which signature 
    void setPanel(javax.swing.JPanel panel)
        _curPanel = panel;
        repaint();
    }to change the EventPanel, but nothing changes.
    In the MainScreen class there is a method call
    _eventPanel.setPanel(new NewPlayerPanel());and nothing changes in the code. I have a JTextArea logging info, and in the constructor for NewPlayerPanel at the end it prints a message in my JTextArea. The Panel is being created but not showing up.
    I have also tried creating the panel in an instance variable, setting it to setVisbile(true) and trying again and it doesnt work.

    In other words...
    char c=evt.getKeyChar();c is some character based on this event.
    if(c=='1'){Ok, let's say it is '1'...
    ...> char c2=evt.getKeyChar();Then c2 is also '1'.evt.getKeyChar() isn't going to magically change to be something different than it returned when you called it a few lines up before, so...>if(c2=='a')...this can never be true, given the above.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Help Meeee!

    My BBM is not working, I send the invitation to my friends & they tell me that does not get anything,Also they send to me the request and i does not get anything.
     Can someone help me ? I got the blackberry curve 9310

    Do you STILL have a BB data plan? Contact your wireless service provider and make sure all is still provisioned correctly. Also, your friends that you are trying to connect with must also have the proper plan.
    1. Please thank those who help you by clicking the "Like" button at the bottom of the post that helped you.
    2. If your issue has been solved, please resolve it by marking the post "Solution?" which solved it for you!

  • PIN Code Need Help on E51 SOS/F1 Help..!

    Hello guys...
    I want to change my pin code of my phone..
    Currently I'm using Nokia E51.
    I change the PIN Code Request to "Yes" and it asked the PIN code. And so where can i get that pin code? My phone is new one and I already try "12345" and "01234" but it didn't work. So, that means it already wrong 2 times. I was told that i can only wrong 3 times. is it right?
    If so, can u guys guide me or help me or any advice about where is that PIN Code????
    if i want to clear the timer of the call duration,etc. I just input "12345". Its ok and its work too. No other code...
    (But now I change my Lock Code from "12345" to something mix with letter and number) But in the PIN Code Request, i can only enter number. So i think PIN code Request code is not this lock code.
    So, can anyone guide me on this?
    Thanks

    The default pin code is set by your network so phone them and ask what it is.

  • Dead bb curve 8520 SOS need help urgently

    hi guys
    I am experiencing several major issues
    1) my phone had been resetting itself a lot lately without reason and randomly. I then downgraded the OS from 5 to 4 then it continued to do the same so I did the removal of the vendor.xml file in the folder of my win 64 bit computer then the blackberry desktop manager, the BBSAK and the computer cannot find my phone. All it does is flash the LED several times in red and wont even restart or show some evidence of life. I have tried everything please help urgently!!!!!

    Hi and Welcome to the Community!
    Please try this sequence...note that, throughout the entire 4h15m process, your BB must remain connected to a known-good wall charger (not PC USB):
    With the battery inside, connect your BB to the wall charger
    Leave it alone for 2 hours, no matter what the LED or the display does
    Remove the battery
    Wait 15 minutes
    Insert the battery
    Wait another 2 hours, no matter what the LED or the display does
    This has been known to "kick start" some BBs.
    It is also possible that your battery or BB has experienced a problem...to test, this sequence is needed:
    Obtain a known good and already fully charged additional battery...use it in your BB and see what happens
    Obtain access to a known good and identical BB...use your battery in it and see what happens
    The results of this will indicate if it's your BB or your battery that has the problem.
    Otherwise, please try this drastic method:
    KB27956 How to recover a BlackBerry smartphone from any state
    Good luck and let us know!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • 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

  • JPanel help Plzzzzzzzzzzz URGENT!

    Hey,
    I have JPanel filled with images........how to identify the images with mouse clicks...????????????????????

    Geez- the guy's a little desperate... be nice, people. It's not that hard.
    Well, to answer the question, you simply need to gather the x/y coordinates of your images, determine the x/y coordinates of your mouseclick: add a Mouse Listener to your JComponent, with a Mouse Input Adapter as its argument. In the MouseInputAdapter, you create the mousePressed() method, like:
    private MouseInputAdapter mia() {
       MouseInputAdapter mia = new MouseInputAdapter() {
          public void mousePressed(MouseEvent evt) {
             int x = evt.getX();
             int y = evt.getY();
    }Somewhere inside your mousePressed code you can have other code that looks to see if it's inside an image, etc. (substitute mouseClicked for mousePressed if you'd rather it be a complete click).
    It's true, though, that the question is vague so a more structured and focussed query would probably gather a more focussed response.
    -Mike Schwager

  • When I try to apply update it tells me firefox is running and when I try to kill firefox it runs suddenly and mmediately after killig process help meeee

    When I try to apply update it tells me firefox is running and when I try to kill firefox it runs suddenly and immediately after killing process help meeee

    hello, in case firefox.exe is always running, this might be a sign of malware active on your pc.
    [[Troubleshoot Firefox issues caused by malware]]
    [[Firefox exe is always running]]

Maybe you are looking for

  • Get Request Offerings by Service Offering using C#

    I utilized the thread here to build a function to get all request offerings for a specific service offering. However, no data is being returned to the relationship object list. I'm not getting any errors and I've verified there are indeed request off

  • Itunes not starting on computer

    I have installed and uninstalled iTunes on my PC numerous times but it will not open.  I have removed the hidden .sicd files and it still won't begin.  I have Windows XP and Google Chrome.  Getting very frustrated, please help in lay man's terms for

  • How to change the location of the "Diamond" on the Timeline

    I am new to Flash and using it for just about a month.  I created a series of approximately ten layers all with motion tweens.  The basic drift is that a series of "letters" are moving from right to left and so on.  Eventually they all land at the sa

  • Process chain--failed infopackage--urgent....

    Hi Experts, can anyone tell me why the process chain when triggered has successfully started but the first infopackages after the start varient did not sucessfully run. the infopackages show in the process chain in yellow status as if the data loadin

  • Problem burning H.264 to Blu-ray in PSE 7

    I have a Dell XPS 435T with an i7 950 (3.07 GHz) and 9 GB RAM running 64 bit Vista. I bought this system specifically configured to edit native AVCHD videos from my camcorder and burn Blu-ray disks. When I first purchased this system (about 10 months