Labels in jdk1.4

Hi, I just started using jdk1.4 and all the labels that used to have this java light purple color are now black. Is this a bug in jdk1.4 or do you have to manualy configure the labels in jdk1.4.

What are you seeing different the background or the forground color? When I switched from jdk1.3 to 1.4 I didn't see any difference in the labels (using Metal or Motif look and feel) . The label foreground color was being set to black and the background was default.

Similar Messages

  • Error when starting Netscape Calendar Server: Module: , Label: 355, Service error: #0x13209

    When starting Netscape Calendar Server, the following error message appears:
    <BR><P>
    Module: , Label: 355, Service error: #0x13209
    <P>
    The three ACIs listed below need to be present in the Directory Server in order
    for Calendar server to work properly. Check the properties on the Base DN to
    verify that the following ACIs exist. If they are not present, you will need
    to add them, and the Base DN will need to be modified for your enviroment.
    <P>
    <OL>
    <LI>ACI for allowing users to modify their own entries.<BR>
    <P>
    (targetattr = "*")(version 3.0; acl "Allow self entry modification";
    allow (write)userdn = "ldap:///self";)<BR>
    <P>
    <LI>ACI for allowing anyone permissions to Read, Search, and Compare.<BR>
    <P>
    (target="ldap:///o=basedn.com") (targetattr != "userPassword") (version
    3.0; acl "Anonymous access";
    allow (read, search, compare) userdn = "ldap:///anyone";)<BR>
    <P>
    <LI>ACI for allowing Calendar Server admins Write access to the Base DN
    (this is necessary in order for admins to add users and resources to the node).
    <BR><P>
    (target="ldap:///o=basedn.com") (targetattr = "*") (version 3.0; acl
    "Calendar Administrators Group";<BR>
    allow(all) groupdn = "ldap:///cn=Calendar Server Admins,ou=Netscape
    Servers,o=basedn.com";)<BR>
    </OL>

    Hi Trinidad,
    Thanks for your help!!!
    1.
    I didn't install EventSender and DIProxy yet, I tried first to upload and deploy the zip files, but I couldn't open the Itegration Application Explorer.
    2.
    The jvm.dll file is in in the folder pointed by the logs: C:\Program Files (x86)\SAP\SAP Business One Integration\jdk1.5.0_xx_sap\jre\bin\server
    and it is also in C:\Program Files (x86)\SAP\SAP Business One Integration\jdk1.5.0_xx_sap_64\jre\bin\server
    I tried running the file  java5w.exe, but I got an error message:
    Access is denied
    Unable to open the service tomcat5
    Thne I managed to open it by "rua as administrator".
    the Java Virtual Machine path is points to the java 1.5 version folder.
    Is it possible that the reason that the service can't start is related to administrator rigts??
    In the properties in the Integration Service (services.msc):
    It is set to be run with the local system account.
    all other properties looks fine.
    in the properties of the tomcat5.exe (and tomcat5w.exe  , I tried both)
    In the Compatibility tab I tried setting the flag "Run this program in compatibility mode for" to Vista, windows 7, and server 2008
    I didn't have the option of Windows XP.
    I have also set the Privilege level of: "Run this program as administrator" to true.
    But still the service won't start.
    What can be the problem?
    What else can I check?
    Thanks a lot,
    Chana

  • Java\jdk1.6.0_02\jre\lib\ext\mysql-connector-java-5.1.16-bin.jar was unexp

    Hello, please i am new to Jdeveloper and weblogic servers and i developed an application using jdeveloper and when i try to run the application it brings up this error message
    "*** Using HTTP port 7101 ***
    *** Using SSL port 7102 ***
    C:\Users\Lucky\AppData\Roaming\JDeveloper\system11.1.2.3.39.62.76.1\DefaultDomain\bin\startWebLogic.cmd
    [waiting for the server to complete its initialization...]
    \Java\jdk1.6.0_02\jre\lib\ext\mysql-connector-java-5.1.16-bin.jar was unexpected at this time.
    Process exited."
    I tried deleting the jdk1.6.6.0_02 and tried it again but it still did not run, I also uninstalled the JDeveloper and weblogic server and reinstalled them but the error message still pops up. Please i need help to fix this.
    Thanks.
    Edited by: Chinedu on Feb 21, 2013 8:48 AM

    Andrew,
    Thanks for the lightning response... but the problem has been solved.
    I rebooted again, and installed again (didn't download again because the filesize checked out) and now it works fine, and I'm none the wiser as to the root cause of the problem, except that rt.jar has magically appeared:
    C:\Users\Administrator>dir "C:\Program Files\Java\jre6\lib\*.jar"
    Volume in drive C has no label.
    Volume Serial Number is 00AC-1BC7
    Directory of C:\Program Files\Java\jre6\lib
    08/11/2009  06:38 PM         6,685,813 charsets.jar
    08/11/2009  06:38 PM         2,989,538 deploy.jar
    08/11/2009  06:38 PM           716,841 javaws.jar
    08/11/2009  06:38 PM            88,256 jce.jar
    08/11/2009  06:38 PM           558,189 jsse.jar
    08/11/2009  06:38 PM               382 management-agent.jar
    08/11/2009  06:38 PM         1,704,664 plugin.jar
    08/11/2009  06:38 PM         1,115,985 resources.jar
    08/11/2009  06:38 PM        44,295,255 rt.jar                             <<<<<<<<<<<<<<<<<<
                   9 File(s)     58,154,923 bytes
                   0 Dir(s)  115,454,173,184 bytes freeSOOOO... I presume that the installer failed on rt.jar, probably because something (something in my start-up, I suppose) was using the JRE while the instal was running... but I didn't do anything different the second time (to the best of my knowledge).
    Thanks anyways... My hair (what's left of it) greatly appreciates your time.
    Cheers. Keith.

  • Problem in reading the JDK1.4Logger configuration file from java prog

    I have written a java program and want to log the messages in a log file , I'm using commons logging with JDK1.4logger as logging subsystem .
    I am facing the problem in reading the JDK1.4Logger configuration file which is commons-logging .properties file from my java program as a result my log messages are appearing directly on the screen while I try to run program , during compilation no error is shown . I have tried to set java.util.logging.config.file ="Path of my commons-logging .properties file " by setting system properties also.
    Please suggest the appropriate solution for this .

    Some webservers won't recognise the resource bundle provided in message-resources
    In that case, you need to specify that resource bundle information in web.xml at the time of specifying the action servlet like this. Check for the init-param application.
    <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
          <param-name>application</param-name>
          <param-value>resource.ApplicationResource</param-value>
        </init-param>
        <init-param>
          <param-name>config</param-name>
          <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <init-param>
          <param-name>debug</param-name>
          <param-value>2</param-value>
        </init-param>
        <init-param>
          <param-name>detail</param-name>
          <param-value>2</param-value>
        </init-param>
        <init-param>
          <param-name>validate</param-name>
          <param-value>true</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
      </servlet>In this, the drawback is, you can not specify the key for your resource bundle. In the JSP, you have to access the property like this.
    <bean:message key="label.fName"/>

  • Is swing does not work in jdk1.4?

    Sirs,
    I've tried to compile the following code,
    import javax.swing.*;
    public class HelloWorldSwing {
    * Create the GUI and show it. For thread safety,
    * this method should be invoked from the
    * event-dispatching thread.
    private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    JFrame frame = new JFrame("HelloWorldSwing");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Add the ubiquitous "Hello World" label.
    JLabel label = new JLabel("Hello World");
    frame.getContentPane().add(label);
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args) {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    But I got the following error,
    C:\j2sdk1.4\bin>javac HelloWorldSwing.java
    HelloWorldSwing.java:2: package javax.awt does not exist
    import javax.awt.*;
    ^
    HelloWorldSwing.java:9: cannot resolve symbol
    symbol : constructor JFrame (java.lang.String)
    location: class JFrame
    JFrame frame = new JFrame("HelloWorldSwing");
    ^
    2 errors
    Does Jdk1.4 is not compatible for executing Swing applications?
    Thanks in advance.

    How long have you been using Java? Swing has been in the javax.swing package for a long time now.
    Your compiler errors don't match your source:
    import javax.swing.*;
    vs
    C:\j2sdk1.4\bin>javac HelloWorldSwing.java
    HelloWorldSwing.java:2: package javax.awt does not exist
    import javax.awt.*;

  • Iconed labels and iconified JFrame

    Hello everybody,
    I have a problem with a strange behaviour of a JFrame.
    In order:
    1. I initialize a JFrame with a JSplitPane
    2. The left component is a JPanel containing 64 JLabels, each with an Icon in it.
    When the frame is coming up, everything is displayed proper. But when I iconify the frame and deiconify later nothing is to see, but a blank frame. The labels will be redisplayed after clicking on the position, where the splitpane-divider should be.
    I'm using jdk1.4
    Can anybody helpme?
    Thanks

    hi,
    hope you've used the frame's getContentPane() method for adding the splitpane, if yes, then that might be some kind of a bug, anyways, add a window listener overriding the windowDeiconified(WindowEvent) method & call the frame's repaint() method,
    hope this helps you,
    reagrds,
    Afroze.

  • Applet label and button attributes being reset.

    Using JDK 1.4 through 1.6, IE6, JBuilder 2005
    I have an applet with a panel that displays the status of external devices and allows the device status to be changed. Here is a brief description.
    The applet has a class that extends JPanel.
    The panel has a set of JButtons that display a color representing the state of the device and text that shows the button action (Open or Close). By default, the JButtons are Green with text = "Open". These are initialized in the init() method of the class that is called only once when it is initialized.
    The panel display class has one method of interest:
    setDeviceStatus() - updates the color and text of the JButtons.
    This is the ONLY ways these components can be changed outside the init() method of the class.
    The method has a System.out.println() statement immediately before any change in text or color.
    There is a simulator applet that is used to send messages via sockets to the display applet.
    Here is what happens.
    1) Applet and panel are initialized correctly.
    2) Simulator applet sends message to update the color and text of a JButton
    3) The message is recieved by the display applet and the setDeviceStatus() method is called.
    4) The print statements before the setText() and setBackground() methods of the Jbuttons are called and new states printed.
    5) Color and text changes on the JButton to Red and Close.
    6) Cursor is moved from JButton and JButton focus is lost.
    7) JButton color and text revert to initial default state of Green and Open.
    There is only ONE call to the setDeviceStatus() method. This call updates the color to RED and text to CLOSE.
    As soon as focus is changed, the display updates to initial values WITHOUT calling the setDeviceStatus() method.
    The behavior is different in JDK 1.4 and 1.6
    JDK1.4) The text and background color change back after focus is lost by either:
    a) Clicking on another window.
    b) Creating an expose event by hiding and redisplaying the applet
    JDK1.6) The text and background color change back after the cursor is moved off of the button.
    CAN ANYONE EXPLAIN HOW TO KEEP THE UPDATED STATUSES????

    Hi Denes,
    I' paste it here ...
    <br><br>
    <table class="t10Button" cellspacing="0" cellpadding="0" border="0" summary=""><br>
    <tr><br>
    <td class="t10L">&lt;a href="#LINK#"&gt;<img src="#IMAGE_PREFIX#themes/theme_10/button_left.gif" alt="" width="4" height="24" /&gt;&lt;/a&gt;</td><br>
    <td class="t10C">&lt;a #BUTTON_ATTRIBUTES# href="#LINK#">#LABEL#&lt;/a&gt;</td><br>
    <td class="t10R">&lt;a href="#LINK#"&gt;<img src="#IMAGE_PREFIX#themes/theme_10/button_right.gif" width="4" height="24" alt="" />&lt;/a&gt;</td><br>
    </tr><br>
    </table><br>
    does this work ...?
    -Carsten
    Message was edited by:
    carstenczarski

  • Html text in label is moving when used as a renderer in a table cell

    Hi everybody,
    Because it is impossible to use gradient background for html, I created a custom TableCellRenderer that uses a JLabel (for the html text) inside a JPanel with a gradient background. (I use jdk1.5.0_06)
    However, in the code that I'm posting, something strange happens. The text is moving up and down as I move with the arrow button along the first row, from left to right and backwards, crossing the entire row.
    You can see for yourself. If someone can explain this behavior, please help!
    public class MyFrame extends javax.swing.JFrame {
        public static void main(String args[]) {
               new MyFrame().setVisible(true);
        public MyFrame() {
             setTitle("Use LEFT & RIGHT buttons to test");
            javax.swing.JTable table = new javax.swing.JTable();
            table.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][] { {"", "", ""}, {"", "", ""}, {"", "", ""}, {"", "", ""}, {"", "", ""}, {"", "", ""} },
                new String []   { "Title 1", "Title 2", "Title 3" }
                public Class getColumnClass(int columnIndex) {
                    return String.class;
            table.setRowHeight(30);
            table.setRowHeight(0,100);
            table.setRowSelectionInterval(0,0);
            table.setColumnSelectionInterval(0,0);
            table.setValueAt("This text MOVES up-down as you move across THIS ROW!!!",0,0);
            table.setValueAt("This text MOVES up-down as you move across THIS ROW!!!",0,1);
            table.setValueAt("This text DOES NOT MOVE as you move across THIS ROW!!!",0,2);
            table.setDefaultRenderer(String.class,new StringRenderer());
            getContentPane().add(table, java.awt.BorderLayout.CENTER);
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setBounds(200,200,500,300);
        class StringRenderer extends GradientPanel implements javax.swing.table.TableCellRenderer {
            public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                   label.setText("<html><p align=center>"+String.valueOf(value)+"</p></html>");
                setColors(new java.awt.Color(255,255,255),isSelected?new java.awt.Color(255,100,100):new java.awt.Color(255,200,200));
                label.setBorder(hasFocus?new javax.swing.border.LineBorder(java.awt.Color.yellow,1):null);
                return this;
        class GradientPanel extends javax.swing.JPanel {
            private java.awt.Color c1,c2;
            protected javax.swing.JLabel label;
            public GradientPanel() {
                label = new javax.swing.JLabel();
                setLayout(new java.awt.GridBagLayout());
                java.awt.GridBagConstraints gbc = new java.awt.GridBagConstraints();
                gbc.fill = java.awt.GridBagConstraints.BOTH;
                gbc.weightx = 1.0;
                gbc.weighty = 1.0;
                gbc.insets = new java.awt.Insets(5,5,5,5);
                add(label, gbc);
            public void setColors(java.awt.Color c1, java.awt.Color c2) {
                this.c1 = c1;
                this.c2 = c2;
                this.repaint();
            public void paintComponent(java.awt.Graphics g) {
                if ( c1 != null && c2 != null ) {
                    java.awt.Graphics2D g2d = (java.awt.Graphics2D)g;
                    g2d.setPaint(new java.awt.GradientPaint(0,0,c2,0,this.getHeight(),c1,false));
                    g2d.fillRect(0,0,this.getWidth(),this.getHeight());
    }

    If someone can explain this behavior, please help!Can't explaing the behavour, but it seems to work fine when you use a JeditorPane or JTextPane which are specifically designed to display HTML.

  • XSQL with jdk1.2.2 - javai.dll error

    I successfully used the xsqlCommandLine utility with jdk1.1.7. When I try with jdk1.2.2, I get an error that javai.dll is not in the path. If I put javai.dll from the 1.1.7/jre/bin in my path, the xsqlCommandLine process runs without end, as if windows (NT) is searching for something else. I'm using the latest classes12.zip and the xmlparserv2.jar files. Any help?
    Thanks.

    robert strzelinski (guest) wrote:
    : Running a small sample program to test connection to Oracle
    : 7.3.4 server. Works OK using thin client connection mode. Using
    : OCI connection causes run-time exception labelled:
    : "java.exe - Unable To Locate DLL"
    : The text in the popup complains of not finding the dynamic link
    : library "javai.dll".
    : This DLL does not exist anywhere in my java distribution tree.
    : What is this library, where does it come from, and where should
    : it be found?
    : -- rjs
    no oracle jdbc oci driver for jdk 1.2 yet ---
    also --
    The only oracle JDBC driver that can run with JDK 1.2.x is in the
    OTN download area and is named "816SDK for JDK 1.2"
    it will work with the JDK 1.2.X using the JDBC 1.22 spec from JDK
    1.1.X.
    IT DOES NOT PROVIDE THE FULL JDBC 2.0 FEATURES/ FUNCTIONALITY
    THAT ARE INCLUDED IN THE JDK 1.2.X CLASSES.
    you're using a jdk 1.2.x/jdbc 2.0 feature -- which is anticipated
    to be included in the 816 driver later this year -- it's not in
    the "816SDK" JDBC driver you're using now..
    816SDK can be thought of as stepping stone between 815 using jdk
    1.1.x and 816 supporting jdk 1.1.x and 1.2.x.
    i think of it as "8.1.5 and a half" to avoid the naming confusion
    between "816sdk" and "816" .
    SEE the following FAQ link for additional details :
    http://technet.oracle.com/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm
    i hope this helps ...
    null

  • Printing with jdk1.1.8

    Hi...I am developing an application for mac(classic) where i need to provide the print functionility.Now Mac supports only upto jdk1.1.8.Has someove ever developed printing with this...code will definetly help.........

    You should start with java.awt.Toolkit.getPrintJob(java.awt.Frame, java.lang.String, java.util.Properties)
    to obtain a PrintJob.
    From the PrintJob object you can get a Graphic by using the Method getGraphics().
    On you first try, produce the Output for the page in some visible AWT component, so you can see it.
    E.g. put your stuff in a panel and add this panel to a Window.
    Then print the Top-Level Component ( thats the panel) that contains your Output by
    calling printAll(Graphics g) on it, with the Graphics object from above.
    Notes:
    You have to take care for Printer borders - your output will be clipped there.
    Code was tested on JDK 1.3, but is designed for JDK 1.1
    Example: Test.java
    import java.awt.*;
    import java.awt.event.*;
    public class Test {
    static Frame f;
    static Panel panelToPrint;
    static class Handler implements ActionListener {
    public void actionPerformed(ActionEvent e) {
    //get a PrintJob (opens the native window)
    PrintJob pj = Toolkit.getDefaultToolkit().getPrintJob(f, "Print-Test", null);
    //get a graphics object to draw on
    Graphics g = pj.getGraphics();
    panelToPrint.printAll( g );
    //end the print job, now it is sent to the printer
    pj.end();
    f.dispose();
    public static void main(String args[]) {
    f = new Frame("Test");
    Button b = new Button("Print...");
    b.addActionListener(new Handler());
    f.add(b,"South");
    panelToPrint = new Panel();
    panelToPrint.add(new Label("Hello World"));
    panelToPrint.add(new Label("Hello World"));
    panelToPrint.add(new Label("Hello World"));
    panelToPrint.add(new Label("Hello World"));
    panelToPrint.add(new Label("Hello World"));
    panelToPrint.add(new Label("Hello World"));
    panelToPrint.add(new Label("Hello World"));
    panelToPrint.add(new Label("Hello World"));
    panelToPrint.add(new Label("Hello World"));
    panelToPrint.add(new Label("Hello World"));
    f.add(panelToPrint, "Center");
    f.setSize(new Dimension(300,400));
    f.setVisible(true);

  • Urgent... Adding focus listeners to labels..

    Hi,
    Is it possible to handle focus events on labels? I tried to add a FocusListener to a label, but the labels aren't receiving any focus. Is there any way to achieve this? I was trying to build a table component with each table cell being represented by a label. The user should be able to navigate across the table cells using arrow keys. Is there any other alternative than using a label?
    regards,
    Anand

    hi!
    from jdk1.4 in java.awt.component class has setFocusable(boolean focusable) method. use this to set the label focusable.
    i hopen this can help you
    :)

  • JDK1.3 problems

    I have just installed jdk1.3 and am having some problems. The System.out.println(); and the System.out.print(); commands don't do anything! I am also unsure how to set the PATH so that I don't have to type the whole directory to compile or run the programmes. If anyone has any ideas I would be gratefull.
    Thanks

    This may duplicate some of what you've already done, if so fine. But please verify you've done exactly what is written or know why you shouldn't before proceeding. You may want to print these instructions before continuing.
    To download the correct software, go here:
    http://java.sun.com/j2se/1.4/download.html
    and click on the word download in this line:
    Windows (all languages, including English) in the column labeled SDK
    After downloading, click on this page of installation instructions and read through #6:
    http://java.sun.com/j2se/1.4/install-windows.html
    Install the software according to the preceeding instructions
    Below is a Helloworld program, copy and paste it into your editor and save it as "HelloWorld.java" Use capitalization, Java is case-sensitive. If you're using Notepad, quote the name when saving, otherwise Notepad adds ".txt" to the name. Go to DOS and check that you've got the file where you want it and that it's named correctly.
    ----------program HelloWorld.java--------------
    public class HelloWorld {
    public static void main (String[] args) {
    System.out.println("Hello World!");
    In the same directory as HelloWorld.java, enter "javac" - the program should print out a list of options, if not, set your PATH - see below.
    In the same directory as HelloWorld.java, enter "javac HelloWorld.java" and the javac compiler will create HelloWorld.class. If it was successful it will not give any messages. Check that the file is created.
    In the same directory as HelloWorld.java, enter "java -cp . HelloWorld" with the spaces and the period. The program will run.
    Here is additional information:
    The Path is a set of pointers that Windows uses to locate programs that you execute, like javac.exe and java.exe. This setting is explained here:
    http://java.sun.com/j2se/1.4/install-windows.html
    Scroll down to: 5. Update the PATH variable
    (you should have already done this as part of the s/w installation)
    The CLASSPATH is another set of pointers that is used by Java to find the files that you create and want compiled and/or run. This setting is explained here:
    Setting the Classpath:
    http://java.sun.com/j2se/1.4/docs/tooldocs/windows/classpath.html
    [NOTE: always start your classpath with ".;" which means the current directory. See my classpath, below]
    How Classes are Found:
    http://java.sun.com/j2se/1.4/docs/tooldocs/findingclasses.html
    Examples:
    This is my path
    PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\BATCH;C:\J2SDK1.4.1\BIN;C:\PROGRA~1\UTILIT~1;C:\PROGRA~1\WIN98RK
    This is my classpath
    CLASSPATH=.;C:\mjava;C:\mnrx;C:\NetRexx\lib\NetRexxC.jar;C:\j2sdk1.4.1\lib\tools.jar;C:\NetRexx\NrxRedBk

  • Problems After shifting swing application from jdk1.3 to 1.4

    hi,
    i have shifted my Swing application from jdk1.3 to 1.4, some component settings changed in j2se1.4. are listed below
    1). i have added JComboBox to JPanel using BoxLayout, in jdk1.3 it is normal where as in 1.4 comboBox height is increased to panel height.
    Sample code
    (in a Panel)
         setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    add(getYearComboBox());
         add(getMonthNameComboBox());
         add(getDayOfMonthComboBox());
    2). in jdk1.3 the icon which is set to JFrame is visible in the JOptioPane.showConfirmationDialog() also, but in 1.4 the icon is not visible in conformation dialog box.
    Sample Code
    in a JFrame's constructor
    public OptionPaneTest()
    ImageIcon icon = new ImageIcon("icon.gif");
    setIconImage(icon.getImage());     
    setSize(250,100);
    addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
    setVisible(true);
    JOptionPane.showMessageDialog(this,"hai", "Hai",JOptionPane.WARNING_MESSAGE);
    3). the Labels added to the panel or frame are displaying in light blue color with jdk1.3 and the same label displaying in black with j2se1.3
    Sample Code
    in a JPanel
    setLayout(new BorderLayout(20, 20));
    add(new JLabel("Testing Label Color"), BorderLayout.CENTER);
    please send solution to any or all.
    thanks in advance,
    Pavan.DV

    Thanks for your sugession.
    You realized me by showing the fact that there are no many classes
    Keep suggesting like this.
    I don't even know how to see the API documentation Before you told me.
    Don't take any issue as simple thing and never give foolish suggessions like this.
    If you know the Answer then share it or else musukoni kurcho ra

  • Application developed using and compliant for jdk1.2.2 needing to get context to WL6.1 running JDK1.3.1

    Note works under JDL 1.3.1, but not under JDK 1.2.2. Is there a fix?
    C:\bea\wlserver6.1\samples>c:\jdk1.3.1_01\bin\java
    examples.jndi.InitialContextExample t3://localhost:9001 system password
    WebLogic context created on behalf of "system"
    C:\bea\wlserver6.1\samples>java examples.jndi.InitialContextExample
    t3://localhost:9001 system password
    java.io.StreamCorruptedException: Type code out of range, is 0
    at java.io.ObjectInputStream.peekCode(ObjectInputStream.java:1280)
    at
    java.io.ObjectInputStream.SkipToEndOfBlockData(ObjectInputStream.java
    :1211)
    at
    java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java
    :776)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:353)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
    at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:978)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
    at
    weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
    bjectInputStream.java:107)
    at
    weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
    bjectInputStream.java:115)
    at
    weblogic.rjvm.ConnectionManager.readPeerInfo(ConnectionManager.java:6
    86)
    at
    weblogic.rjvm.ConnectionManagerClient.handleIdentifyResponse(Connecti
    onManagerClient.java:140)
    at
    weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:627)
    at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java,
    Compi
    led Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:
    24)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
    Code)
    --------------- nested within: ------------------
    weblogic.utils.AssertionError: ***** ASSERTION FAILED ***** - with nested
    except
    ion:
    [java.io.StreamCorruptedException: Type code out of range, is 0]
    at
    weblogic.rjvm.ConnectionManager.readPeerInfo(ConnectionManager.java:6
    88)
    at
    weblogic.rjvm.ConnectionManagerClient.handleIdentifyResponse(Connecti
    onManagerClient.java:140)
    at
    weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:627)
    at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java,
    Compi
    led Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:
    24)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
    Code)
    Failed to contact t3://localhost:9001.
    Is there a server running at this address?
    C:\bea\wlserver6.1\samples>

    Right. Using WebLogic RMI proprietary implementation (t3) with 6.1 requires
    1.3 on the client side. If you absolutely have to use 1.2 on the client side,
    IIOP should work - I just tried this and it looks like WebLogic 6.1 implements
    EJB spec interop requirements pretty well.
    Jonathon Cano <[email protected]> wrote:
    I saw an article saying use iiop and then deploy your beans for such. I can
    get context over IIOP using jdk1.2.2 to WLS 6.1. I have not yet deployed
    beans or recompiled anything to try this all the way. Does this work?
    Should I proceed? or is there a gotcha?
    "Dimitri Rakitine" <[email protected]> wrote in message
    news:[email protected]...
    6.1 requires 1.3 on the client. (it uses dynamic proxies, so 1.2 willnot
    work).
    Jonathon Cano <[email protected]> wrote:
    Note works under JDL 1.3.1, but not under JDK 1.2.2. Is there a fix?
    C:\bea\wlserver6.1\samples>c:\jdk1.3.1_01\bin\java
    examples.jndi.InitialContextExample t3://localhost:9001 system password
    WebLogic context created on behalf of "system"
    C:\bea\wlserver6.1\samples>java examples.jndi.InitialContextExample
    t3://localhost:9001 system password
    java.io.StreamCorruptedException: Type code out of range, is 0
    at
    java.io.ObjectInputStream.peekCode(ObjectInputStream.java:1280)
    at
    java.io.ObjectInputStream.SkipToEndOfBlockData(ObjectInputStream.java
    :1211)
    at
    java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java
    :776)
    atjava.io.ObjectInputStream.readObject(ObjectInputStream.java:353)
    atjava.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
    atjava.io.ObjectInputStream.inputObject(ObjectInputStream.java:978)
    atjava.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
    atjava.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
    at
    weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
    bjectInputStream.java:107)
    at
    weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
    bjectInputStream.java:115)
    at
    weblogic.rjvm.ConnectionManager.readPeerInfo(ConnectionManager.java:6
    86)
    at
    weblogic.rjvm.ConnectionManagerClient.handleIdentifyResponse(Connecti
    onManagerClient.java:140)
    at
    weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:627)
    atweblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java,
    Compi
    led Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:
    24)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,Compiled
    Code)
    --------------- nested within: ------------------
    weblogic.utils.AssertionError: ***** ASSERTION FAILED ***** - withnested
    except
    ion:
    [java.io.StreamCorruptedException: Type code out of range, is 0]
    at
    weblogic.rjvm.ConnectionManager.readPeerInfo(ConnectionManager.java:6
    88)
    at
    weblogic.rjvm.ConnectionManagerClient.handleIdentifyResponse(Connecti
    onManagerClient.java:140)
    at
    weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:627)
    atweblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java,
    Compi
    led Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:
    24)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,Compiled
    Code)
    Failed to contact t3://localhost:9001.
    Is there a server running at this address?
    C:\bea\wlserver6.1\samples>--
    Dimitri
    Dimitri

  • NEED HELP IN LABELLING A TRIANGLE _ VERTICES

    PLEASE HELP ______
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.text.NumberFormat;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.DefaultTableCellRenderer;
    import java.lang.*;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseMotionListener;
    import java.awt.FileDialog;
    import java.io.*;
    import java.awt.BorderLayout;
    import java.awt.Container;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseMotionListener;
    import javax.swing.JFrame;
    public class Geometry {
        CardLayout cards;
        JPanel panel;
        public Geometry() {
            cards = new CardLayout();
            panel = new JPanel(cards);
            addCards();
            JFrame f = new JFrame("Geometry");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setJMenuBar(getMenuBar());
            f.getContentPane().add(panel);
            f.setSize(500,500);
            f.setLocation(0,0);
            f.setVisible(true);
            f.addMouseMotionListener(
            new MouseMotionListener() { //anonymous inner class
                //handle mouse drag event
                public void mouseMoved(MouseEvent e) {
                   System.out.println("Mouse  " + e.getX() +","  + e.getY());
                public void mouseDragged(MouseEvent e) {
                    System.out.println("Draggg: x=" + e.getX() + "; y=" + e.getY());
            //            public void mouseMoved(MouseEvent me) {
            //                System.out.println("Moving: x=" + me.getX() + "; y=" + me.getY());
            //        panel.addMouseMotionListener(
            //        new MouseMotionListener() { //anonymous inner class
            //            //handle mouse drag event
            //           public void mouseDragged(MouseEvent me) {
            //               setTitle("Dragging: x=" + me.getX() + "; y=" + me.getY());
            //            public void mouseMoved(MouseEvent me) {
            //                setTitle("Moving: x=" + me.getX() + "; y=" + me.getY());
        private void addCards() {
            // card one
            TriangleModel tri = new TriangleModel(175,100,175,250,325,250);
            TriangleView view  = new TriangleView(tri);
            JPanel panelOne = new JPanel(new BorderLayout());
            panelOne.add(view.getUIPanel(), "North");
            panelOne.add(view);
            panelOne.add(view.getTablePanel(), "South");
            panelOne.setName("Pythagoras's Theorem");
            panel.add("Pythagoras's Theorem", panelOne);
                  view.addMouseMotionListener(
            new MouseMotionListener() { //anonymous inner class
                //handle mouse drag event
                 public void mouseMoved(MouseEvent e) {
                    System.out.println("Mouse at " + e.getX() +","  + e.getY());
               public void mouseDragged(MouseEvent e) {
                   System.out.println("Dragging: x=" + e.getX() + "; y=" + e.getY());
            // card two
            TestModel trin = new TestModel(175,100,175,250,325,250);
            TestView viewn  = new TestView(trin);
            JPanel panelTwo = new JPanel(new BorderLayout());
            panelTwo.add(viewn.getUIPanel(), "North");
          // panelTwo.setBackground(Color.blue);
            panelTwo.setName("Similar Triangles");
            panelTwo.add(viewn);
            panelTwo.add(viewn.getTablePanel(), "South");
                  viewn.addMouseMotionListener(
            new MouseMotionListener() { //anonymous inner class
                //handle mouse drag event
                 public void mouseMoved(MouseEvent e) {
                    System.out.println("Mouse at " + e.getX() +","  + e.getY());
               public void mouseDragged(MouseEvent e) {
                   System.out.println("Dragging: x=" + e.getX() + "; y=" + e.getY());
            panel.add("Similar Triangles", panelTwo);
            JPanel panelThree = new JPanel();
            panelThree.setBackground(Color.white);
            panelThree.setName("Circle Theorem1");
            panel.add("Circle Theorem1", panelThree);
        private JMenuBar getMenuBar() {
            JMenu File = new JMenu("File");
            JSeparator separator1 = new JSeparator();
            JMenuItem Open = new JMenuItem("Open");
    //         Open.addActionListener(new java.awt.event.ActionListener() {
    //            public void actionPerformed(java.awt.event.ActionEvent evt) {
    //                openActionPerformed(evt);
            JMenuItem Save = new JMenuItem("Save");
            JMenuItem Print = new JMenuItem("Print");
            JMenuItem Exit = new JMenuItem("Exit");
            Exit.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    ExitActionPerformed(evt);
            JMenu theorem = new JMenu("Theorem");
            ActionListener l = new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    JMenuItem item = (JMenuItem)e.getSource();
                    String name = item.getActionCommand();
                    cards.show(panel, name);
            Component[] c = panel.getComponents();
            for(int j = 0; j < panel.getComponentCount(); j++) {
                String name = c[j].getName();
                JMenuItem item = new JMenuItem(name);
                item.setActionCommand(name);
                item.addActionListener(l);
                theorem.add(item);
            JMenuBar menuBar = new JMenuBar();
            JMenuBar menuBar1 = new JMenuBar();
            menuBar.add(File);
            File.add(Open);
            File.add(separator1);
            File.add(Save);
            File.add(Print);       
            File.add(Exit);
            menuBar.add(theorem);
            return menuBar;
    //    private void openActionPerformed(java.awt.event.ActionEvent evt) {
    //        FileDialog fileDialog = new FileDialog(this, "Open...", FileDialog.LOAD);
    //        fileDialog.show();
    //        if (fileDialog.getFile() == null)
    //            return;
    //        fileName = fileDialog.getDirectory() + File.separator + fileDialog.getFile();
    //        FileInputStream fis = null;
    //        String str = null;
    //        try {
    //            fis = new FileInputStream(fileName);
    //            int size = fis.available();
    //            byte[] bytes = new byte [size];
    //            fis.read(bytes);
    //            str = new String(bytes);
    //        } catch (IOException e) {
    //        } finally {
    //            try {
    //                fis.close();
    //            } catch (IOException e2) {
    //        if (str != null)
    //            textBox.setText(str);
        private void ExitActionPerformed(java.awt.event.ActionEvent evt) {
            // TODO add your handling code here:
            System.exit(0);
        public static void main(String[] args) {
            new Geometry();
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.text.NumberFormat;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.DefaultTableCellRenderer;
    public class Triangle
    public Triangle()
    TriangleModel tri = new TriangleModel(175,100,175,250,325,250);
    TriangleView view = new TriangleView(tri);
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(view.getUIPanel(), "North");
    f.getContentPane().add(view);
    f.getContentPane().add(view.getTablePanel(), "South");
    f.setSize(500,500);
    f.setLocation(200,200);
    f.setVisible(true);
    import java.awt.Point;
    import java.awt.Rectangle;
    import java.awt.event.MouseEvent;
    import javax.swing.JTable;
    import javax.swing.event.MouseInputAdapter;
    * TriangleControl.java
    * Created on 06 February 2005, 01:19
    * @author  Rahindra Naidoo
    public class TriangleControl extends MouseInputAdapter
        TriangleView view;
        TriangleModel model;
        Point start;
        boolean dragging, altering;
        Rectangle lineLens;            // used for line selection
        public TriangleControl(TriangleView tv)
            view = tv;
            model = view.getModel();
            dragging = altering = false;
            lineLens = new Rectangle(0, 0, 6, 6);
        public void mousePressed(MouseEvent e)
            Point p = e.getPoint();
            lineLens.setLocation(p.x - 3, p.y - 3);
            // are we over a line
            if(model.isLineSelected(lineLens))
                start = p;
                altering = true;
            // or are we within the triangle
            else if(model.contains(p))
                start = p;
                dragging = true;
        public void mouseReleased(MouseEvent e)
            altering = false;
            dragging = false;
            view.getCentroidLabel().setText("centroid location: " +
                                             model.findCentroid());
            view.repaint();  // for the construction lines
        public void mouseDragged(MouseEvent e)
            Point p = e.getPoint();
            if(altering)
                int x = p.x - start.x;
                int y = p.y - start.y;
                model.moveSide(x, y, p);
                updateTable();
                view.repaint();
                start = p;
            else if(dragging)
                int x = p.x - start.x;
                int y = p.y - start.y;
                model.translate(x, y);
                view.repaint();
                start = p;
        private void updateTable()
            String[] lengths = model.getLengths();
            String[] squares = model.getSquares();
            String[] angles  = model.getAngles();
            JTable table = view.getTable();
            for(int j = 0; j < angles.length; j++)
                table.setValueAt(lengths[j], 1, j + 1);
                table.setValueAt(squares[j], 2, j + 1);
                table.setValueAt(angles[j],  3, j + 1);
            view.getCentroidLabel().setText("centroid location: " +
                                             model.findCentroid());
    * TriangleModel.java
    * Created on 06 February 2005, 01:18
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.text.NumberFormat;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.DefaultTableCellRenderer;
    * @author  Rahindra Naidoo
    public class TriangleModel                      //  (x1, y1)
    {                                         //      |\
        static final int SIDES = 3;         //      | \
        private int cx, cy;                  //      |  \
        Polygon triangle;                     //      |_ _\ (x3, y3)
        int selectedIndex;                   //  (x2, y2)
        NumberFormat nf;
        Line2D[] medians;
        Point2D centroid;
        public TriangleModel(int x1, int y1, int x2, int y2, int x3, int y3)
            int[] x = new int[] { x1, x2, x3 };
            int[] y = new int[] { y1, y2, y3 };
            triangle = new Polygon(x, y, SIDES);
            nf = NumberFormat.getNumberInstance();
            nf.setMaximumFractionDigits(1);
        public boolean contains(Point p)
            // Polygon.contains doesn't work well enough
            return (new Area(triangle)).contains(p);
        public boolean isLineSelected(Rectangle r)
            Line2D line = new Line2D.Double();
            for(int j = 0; j < SIDES; j++)
                int[] x = triangle.xpoints;
                int[] y = triangle.ypoints;
                int x1 = x[j];
                int y1 = y[j];
                int x2 = x[(j + 1) % SIDES];
                int y2 = y[(j + 1) % SIDES];
                line.setLine(x1, y1, x2, y2);
                if(line.intersects(r))
                    selectedIndex = j;
                    return true;
            selectedIndex = -1;
            return false;
         * Only works for right triangle with right angle at (x2, y2)
        public void moveSide(int dx, int dy, Point p)
            int[] x = triangle.xpoints;
            int[] y = triangle.ypoints;
            switch(selectedIndex)
                case 0:
                    x[0] += dx;
                    x[1] += dx;
                    break;
                case 1:
                    y[1] += dy;
                    y[2] += dy;
                    break;
                case 2:
                    double rise  = y[2] - y[0];
                    double run   = x[2] - x[0];
                    double slope = rise/run;
                    // rise / run == (y[2] - p.y) / (x[2] - p.x)
                    x[2] = p.x + (int)((y[2] - p.y) / slope);
                    // rise / run == (p.y - y[0]) / (p.x - x[0])
                    y[0] = p.y - (int)((p.x - x[0]) * slope);
        public void translate(int dx, int dy)
            triangle.translate(dx, dy);
        public Polygon getTriangle()
            return triangle;
        public String findCentroid()
            int[] x = triangle.xpoints;
            int[] y = triangle.ypoints;
            // construct the medians defined as the line from
            // any vertex to the midpoint of the opposite line
            medians = new Line2D[x.length];
            for(int j = 0; j < x.length; j++)
                int next = (j + 1) % x.length;
                int last = (j + 2) % x.length;
                Point2D vertex = new Point2D.Double(x[j], y[j]);
                // get midpoint of line opposite vertex
                double dx = ((double)x[last] - x[next])/2;
                double dy = ((double)y[last] - y[next])/2;
                Point2D oppLineCenter = new Point2D.Double(x[next] + dx,
                                                           y[next] + dy);
                medians[j] = new Line2D.Double(vertex, oppLineCenter);
            // centroid is located on any median 2/3 the way from the
            // vertex (P1) to the midpoint (P2) on the opposite side
            double[] lengths = getSideLengths();
            double dx = (medians[0].getX2() - medians[0].getX1())*2/3;
            double dy = (medians[0].getY2() - medians[0].getY1())*2/3;
            double px = medians[0].getX1() + dx;
            double py = medians[0].getY1() + dy;
            //System.out.println("px = " + nf.format(px) +
            //                 "\tpy = " + nf.format(py));
            centroid = new Point2D.Double(px, py);
            return "(" + nf.format(px) + ",  " + nf.format(py) + ")";
        public String[] getAngles()
            double[] lengths = getSideLengths();
            String[] vertices = new String[lengths.length];
            for(int j = 0; j < lengths.length; j++)
                int opp  = (j + 1) % lengths.length;
                int last = (j + 2) % lengths.length;
                double top = lengths[j] * lengths[j] +
                             lengths[last] * lengths[last] -
                             lengths[opp] * lengths[opp];
                double divisor = 2 * lengths[j] * lengths[last];
                double vertex = Math.acos(top / divisor);
                vertices[j] = nf.format(Math.toDegrees(vertex));
            return vertices;
        public String[] getLengths()
            double[] lengths = getSideLengths();
            String[] lengthStrs = new String[lengths.length];
            for(int j = 0; j < lengthStrs.length; j++)
                lengthStrs[j] = nf.format(lengths[j]);
            return lengthStrs;
        public String[] getSquares()
            double[] lengths = getSideLengths();
            String[] squareStrs = new String[lengths.length];
            for(int j = 0; j < squareStrs.length; j++)
                squareStrs[j] = nf.format(lengths[j] * lengths[j]);
            return squareStrs;
        private double[] getSideLengths()
            int[] x = triangle.xpoints;
            int[] y = triangle.ypoints;
            double[] lengths = new double[SIDES];
            for(int j = 0; j < SIDES; j++)
                int next = (j + 1) % SIDES;
                lengths[j] = Point.distance(x[j], y[j], x[next], y[next]);
            return lengths;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.text.NumberFormat;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.DefaultTableCellRenderer;
    * TriangleView.java
    * Created on 06 February 2005, 01:21
    public class TriangleView extends JPanel
        private TriangleModel model;
        private Polygon triangle;
        private JTable table;
        private JLabel centroidLabel;
        private boolean showConstruction;
        TriangleControl control;
        public TriangleView(TriangleModel model)
            this.model = model;
            triangle = model.getTriangle();
            showConstruction = false;
            control = new TriangleControl(this);
            addMouseListener(control);
            addMouseMotionListener(control);
        public void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            g2.draw(triangle);
            if(model.medians == null)
                centroidLabel.setText("centroid location: " + model.findCentroid());
            // draw medians and centroid point
            if(showConstruction && !control.dragging)
                g2.setPaint(Color.red);
                for(int j = 0; j < 3; j++)
                    g2.draw(model.medians[j]);
                g2.setPaint(Color.blue);
                g2.fill(new Ellipse2D.Double(model.centroid.getX() - 2,
                                             model.centroid.getY() - 2, 4, 4));
        public TriangleModel getModel()
            return model;
        public JTable getTable()
            return table;
        public JLabel getCentroidLabel()
            return centroidLabel;
        public JPanel getUIPanel()
            JCheckBox showCon = new JCheckBox("show construction");
            showCon.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    boolean state = ((JCheckBox)e.getSource()).isSelected();
                    showConstruction = state;
                    repaint();
            JPanel panel = new JPanel();
            panel.add(showCon);
            return panel;
        public JPanel getTablePanel()
            String[] headers = new String[] { "", "", "", "" };
            // row and column data labels
            String[] rowHeaders = {
                "sides", "lengths", "squares", "angles", "degrees"
            String[] sidesRow = { "vertical", "horizontal", "hypotenuse" };
            String[] anglesRow = { "hyp to ver", "ver to hor", "hor to hyp" };
            // collect data from model
            String[] angles  = model.getAngles();
            String[] lengths = model.getLengths();
            String[] squares = model.getSquares();
            String[][] allData = { sidesRow, lengths, squares, anglesRow, angles };
            int rows = 5;
            int cols = 4;
            Object[][] data = new Object[rows][cols];
            for(int row = 0; row < rows; row++)
                data[row][0] = rowHeaders[row];
                for(int col = 1; col < cols; col++)
                    data[row][col] = allData[row][col - 1];
            table = new JTable(data, headers)
                public boolean isCellEditable(int row, int col)
                    return false;
            DefaultTableCellRenderer renderer =
                (DefaultTableCellRenderer)table.getDefaultRenderer(String.class);
            renderer.setHorizontalAlignment(JLabel.CENTER);
            centroidLabel = new JLabel("centroid location:  ", JLabel.CENTER);
            Dimension d = centroidLabel.getPreferredSize();
            d.height = table.getRowHeight();
            centroidLabel.setPreferredSize(d);
            JPanel panel = new JPanel(new BorderLayout());
            panel.setBorder(BorderFactory.createTitledBorder("triangle data"));
            panel.add(table);
            panel.add(centroidLabel, "South");
            return panel;
    }PLEASE HELP ME TO LABEL THE TRIANGLE AND CHANGE THE VALUES OF THE JTABLE - to SHOW ASquare b Square and C square as well as a label on the bottom of the screen to show A^2 + B^2 = C^2 ...
    ThANKS

        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
            g2.drawPolygon(triangle);
            // label the triangle
            String[] lengths = model.getLengths();
            String[] squares = model.getSquares();
            String[] angles  = model.getAngles();
            int[] x = triangle.xpoints;
            int[] y = triangle.ypoints;
            for(int j = 0; j < x.length; j++) {
                Point2D vertex = new Point2D.Double(x[j], y[j]);
                int next = (j + 0) % x.length;
                int last = (j + 1) % x.length;
                double dx = ((double)x[last] - x[next])/2;
                double dy = ((double)y[last] - y[next])/2;
                Point2D center = new Point2D.Double(x[next] + dx, y[next] + dy);
                g2.drawString(angles[j],(int)vertex.getX(),(int)vertex.getY());
                g2.drawString(lengths[j],(int)center.getX(),(int)center.getY());
            g2.drawString(squares[0],100, getHeight());
            g2.drawString(" + "+squares[1],150, getHeight());
            g2.drawString(" = "+squares[2],200, getHeight());
            if(model.medians == null)
                centroidLabel.setText("centroid location: " + model.findCentroid());
            // draw medians and centroid point
            if(showConstruction && !control.dragging) {
                g2.setPaint(Color.red);
                for(int j = 0; j < 3; j++)
                    g2.draw(model.medians[j]);
                g2.setPaint(Color.blue);
                g2.fill(new Ellipse2D.Double(model.centroid.getX() - 2,
                        model.centroid.getY() - 2, 4, 4));
        }

Maybe you are looking for