Centering text with drawString() in applet

I want to draw a String in the center of my applet, is there a way to tell it to draw itself centered, or is there a way to find the width of the string to position it absolutely? Which would be easier? Thanks.

You can use the graphics' font metrics (especially the stringWidth (String) method).
Kind regards,
  Levi

Similar Messages

  • Centering text with drawString();

    Hi there! I'm putting some text inside some shapes (ellipses). So far woked great the alignment, here's my piece of code :
    Font thisFont = new Font("Arial", Font.PLAIN, 11);
              g.setFont(thisFont);
              g.setPaint(Color.black);
              FontMetrics metrics = g.getFontMetrics();
              int strWidth = metrics.stringWidth(this.objetivo);
              int h = metrics.getHeight();
              int fontXOffset = ((this.width - strWidth) / 2) + this.x;
              int fontYOffset = ((this.height + h) / 2) + this.y;Problem is when my string gets bigger than the ellipse width. I'd like to break it into new lines and than arrange it on the center of the shape.
    Any ideias???

    Yep, but considering that I don't know how many lines
    does my text will have, I wont be able to center it
    vertically. Because, a text with only one line, doesnt
    start at the same point as a text that has 3 lines,
    agree with me?I understand now: you want to center vertically as well as horizontally.
    You'll have to do 2 passes:
    1. determine how many lines the text will be broken into, but don't draw.
    2. draw the text, centered vertically, and additionally horizontally if you wish.
    You could either accumulate the TextLayouts from 1 to use in 2, or recompute them.

  • Centering Text with CS5

    Hi Folks,
    I usually add a 200px white matte around my photos, and put a couple of lines of text at the bottom to give the image a title, and to include my name.
    The two lines of text end up on two seperate text layers, and I usually just use the move tool to position / centre them "by eye" ... and 1/2 the time when I've flattened the image - converted it to sRGB profile - uploaded it to the website - linked to it from a forum etc I THEN discover that I've done a bad job of aligning the text (eg line 2 may not be centred with respect to line 1 etc).
    Just wondering if anyone has any workflows that would make this text aligning step easier? It would also be great if it were possible to have the rulers centered on the image (ie so zero is in the middle), with a couple of highlights representing the ends of the text - anyone know if this is possible?
    Many thanks,
    Cheers,
    Colin Southern

    Thanks folks,
    Problem solved, thanks to your help!

  • Centering texts with DefaultTableCellRenderer

    Hi,
    I 've created a JTable and now I am trying to center the text in the cells of the table.
    I am using an AbstractTableModel for this table and the data are store in a vector.
    I tried to extends DefaultTableCellRenderer like this but it did not work because (I think) of the vector.
    Here a snippet:
    class centerTextRenderer extends DefaultTableCellRenderer{
    public centerTextRenderer(){
    setHorizontalAlignment(CENTER );
    public void setValue( Object value){
    setText( value.toString() );
    Does anyone have a suggestion?
    --kirk123

    Your class looks OK (you don't even need to override the setValue() method). Did you tell your table to use your renderer?
    table.setDefaultRenderer(Object.class, new CenterTextRenderer());
    Note: the Java convention is to use upper case characters for all words in a class name.

  • Problem with GUI in applet

    Hai to all,
    I am having a problem with GUI in applets
    My first class extends a JPanel named A_a
    import javax.swing .*;
    import java.awt.*;
    import java.awt.event.*;
    public class A_a extends JPanel
    JButton jb;
    JTextArea text;
    public A_a()
    setLayout(new FlowLayout());
    jb=new JButton("Click me");
    //add(jb);
    text=new JTextArea(5,20);
    add(text);
    public void text_appendText(String aa)
    System.out.println("I AM IN A_a");
    text.append(aa);
    text.revalidate();
    revalidate();
    /*public static void main(String ags[])
    A_a a = new A_a();
    JFrame frame=new JFrame();
    frame.getContentPane().add(a);
    frame.pack();
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) { System.exit(0); }
    frame.setSize(200,200);
    frame.show();
    and then I am using other class B_b which is an applet carries a exitsing panel (A_a) inside it .
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class B_b extends JApplet
    public A_a a;
    public void init()
    a=new A_a();
    getContentPane().add(a);
    public void text_appendText(String aa)
    final String aaa =aa;
    new Thread(new Runnable()
    public void run()
    a=new A_a();
    a.setBackground(new java.awt.Color(255,200,200));
    System.out.println("I AM IN B_b");
    a.text.append(aaa);
    a.text.revalidate();
    getContentPane().remove(a);
    resize(500,500);
    }).start();
    and the I am using the second applet C_c in which by performing a button action the old panel A_a should get removed and replace the new panel D_a (which is not here )in the applet B_b with all other components(namely button , text fields etc)
    import javax.swing .*;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.util.*;
    public class C_c extends JApplet implements ActionListener
    JButton jbt;
    JTextArea jta;
    public void init()
    getContentPane().setLayout(new FlowLayout());
    jbt=new JButton("Click me");
    jbt.addActionListener(this);
    getContentPane().add(jbt);
    jta=new JTextArea(5,20);
    getContentPane().add(jta);
    public void actionPerformed(ActionEvent ae)
    Enumeration e = getAppletContext().getApplets();
    Applet applets = null;
    while(e.hasMoreElements())
    applets=(Applet)e.nextElement();
    if ( applets instanceof B_b)
    System.out.println("I AM CLASS C_c");
    ((B_b)applets).text_appendText(jta.getText());
    ((B_b)applets).remove());
    ((B_b)applets).getContentPane().add(D_d);
    both the applets C_c and B_b are in same browser page
    How can i achive that pls help .

    Just to make the code readable...
    import javax.swing .*;
    import java.awt.*;
    import java.awt.event.*;
    public class A_a extends JPanel
    JButton jb;
    JTextArea text;
    public A_a()
    setLayout(new FlowLayout());
    jb=new JButton("Click me");
    //add(jb);
    text=new JTextArea(5,20);
    add(text);
    public void text_appendText(String aa)
    System.out.println("I AM IN A_a");
    text.append(aa);
    text.revalidate();
    revalidate();
    /*public static void main(String ags[])
    A_a a = new A_a();
    JFrame frame=new JFrame();
    frame.getContentPane().add(a);
    frame.pack();
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) { System.exit(0); }
    frame.setSize(200,200);
    frame.show();
    }and then I am using other class B_b which is an applet carries a exitsing panel (A_a) inside it .
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class B_b extends JApplet
    public A_a a;
    public void init()
    a=new A_a();
    getContentPane().add(a);
    public void text_appendText(String aa)
    final String aaa =aa;
    new Thread(new Runnable()
    public void run()
    a=new A_a();
    a.setBackground(new java.awt.Color(255,200,200));
    System.out.println("I AM IN B_b");
    a.text.append(aaa);
    a.text.revalidate();
    getContentPane().remove(a);
    resize(500,500);
    }).start();
    }and the I am using the second applet C_c in which by performing a button action the old panel A_a should get removed and replace the new panel D_a (which is not here )in the applet B_b with all other components(namely button , text fields etc)
    import javax.swing .*;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.util.*;
    public class C_c extends JApplet implements ActionListener
    JButton jbt;
    JTextArea jta;
    public void init()
    getContentPane().setLayout(new FlowLayout());
    jbt=new JButton("Click me");
    jbt.addActionListener(this);
    getContentPane().add(jbt);
    jta=new JTextArea(5,20);
    getContentPane().add(jta);
    public void actionPerformed(ActionEvent ae)
    Enumeration e = getAppletContext().getApplets();
    Applet applets = null;
    while(e.hasMoreElements())
    applets=(Applet)e.nextElement();
    if ( applets instanceof B_b)
    System.out.println("I AM CLASS C_c");
    ((B_b)applets).text_appendText(jta.getText());
    ((B_b)applets).remove());
    ((B_b)applets).getContentPane().add(D_d);
    }

  • Reading and writing to a text file from an Applet

    I'm a novice java programming with very little formal programming training. I've pieced together enough knowledge to do what I've wanted to do so far...
    However, I've been unable to figure out how to read and write to a text file from an Applet (I can do it from a normal java program just fine). Here is a simple example of what I'd like to do (you can also look at it on my website: www.stat.colostate.edu/~leach/test02/test02.html). I know that there is some problem with permission/security but I'm not smart enough to understand what the error messages are telling or understand the few books I have. If anyone can tell me how to get this applet to work, or direct me to some referrences that would help me out I'd really appreciate it.
    Thanks,
    Andy
    import java.applet.Applet;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    public class test02 extends Applet {
    public Button B_go;
    public GridBagConstraints c;
    public void init() {
    this.setLayout(new GridBagLayout());
    c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    B_go = new Button("GO");
    c.gridx=1; c.gridy=0; c.gridwidth=1; c.gridheight=1;
    c.weightx = c.weighty = 0.0;
    B_go.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    print_stuff();
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    this.add(B_go,c);
    public static void print_stuff() {
    try{
    File f = new File("test02.txt");
    PrintWriter out = new PrintWriter(new FileWriter(f));
    out.print("This is test02.txt");
    out.close();
    }catch(IOException e){**/}
    }

    I have almost the exact same problem, and I am in the same situation as you are with respects to the language.
    I am simply trying to create a file and output some garbage to it but my applet always spits back a security violation. I've tried eliminating the restrictions on the applet runner I use but I still get the error.
    My method:
    debug = new Label() ;
    debug.setLocation( 20, 20 ) ;
    debug.setSize( 500, 15 ) ;
    add( debug ) ;
    // output
    try
         OutputStream file = new FileOutputStream( new File( "" + getCodeBase() + "output.txt" ) ) ;
         byte[] buffer = { 1, 2, 3, 4, 5 } ;
         file.write( buffer ) ;
         file.close() ;
    } catch( Exception e )
         debug.setText( e.toString() ) ;
         Can anyone tell why this isnt working?

  • Displaying html page with in the applet

    I want to open an html page in the applet. If i use showDocument() of applet, it opens the html page in the browser, but i want to open the html page with in the applet(i.e., applet should display the html page). Is there any way which i can do the above thing.
    Thanks in advance

    Look at this sample:
    import java.awt.*;
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.text.*;
    public class BrwsA extends JApplet
         JPanel      jpa = new JPanel();
         JEditorPane jed = new JEditorPane();
         JScrollPane jsp = new JScrollPane(jpa);
    public BrwsA()
         jpa.setLayout(new BorderLayout());
         jpa.add(jed);
         jpa.setPreferredSize(new Dimension(800,1000));
         jed.setEditable(false);
         jed.setContentType("text/html");
         jed.getEditorKit().createDefaultDocument();
         setContentPane(jsp);
    public void init()
         try
              URL url = new URL(getCodeBase(),"test.html");
              jed.setPage(url);
         catch(MalformedURLException e)
         catch(IOException e)
    }Noah

  • I need a report in SAP which allows multiple Profit centers selection with

    Hi,
        Cany anybody help me with below issue -
    I need a report in SAP which allowing multiple Profit centers selection with :
    - Profit Center #
    - Profit center Name
    - Profit center long text
    - Profit Center group
    - the related PC node showing the BU and the product category group.
    Let me know is there any report which can provide us with all this details.
    With regards.

    Hi,
    I recommend the PCA standard drill-down or interactive reports accessible via the follwoing menu path:
    Accounting --> Enterprise Controlling --> PCA --> Infosystem --> Reports for PCA
    There are several reports which allow entering profitcenter groups or profitcenters.
    Long Text is not possible. Makes also no sense to report on Long Text.
    Best regards,
    Andreas

  • Centered text in PDF

    Hi
    I am new to this Acrobat SDK forum. I am trying to write a PDF code, but I have problems centering text. Below is a short "program" that writes the text "Centered text" starting at position x=100, y=600. But how do I center this text at some position, say x=200, y=600 ?  Can anyone help?
    - gullipeX
    %PDF-1.4
    1 0 obj
       << /Type /Catalog
          /Outlines 2 0 R
          /Pages 3 0 R
       >>
    endobj
    2 0 obj
       << /Type /Outlines
          /Count 0
       >>
    endobj
    3 0 obj
       << /Type /Pages
          /Kids [ 4 0 R ]
          /Count 1
       >>
    endobj
    4 0 obj
       << /Type /Page
          /Parent 3 0 R
          /MediaBox [ 0 0 612 792 ]
          /Contents 5 0 R
          /Resources << /ProcSet 6 0 R
                      /Font << /F1 7 0 R >>
                      >>
       >>
    endobj
    5 0 obj
       << /Length 73 >>
    stream
    BT
       /F1 24 Tf
       100 600 Td
       ( Centered text ) Tj
    ET
    endstream
    endobj
    6 0 obj
       [ /PDF /Text ]
    endobj
    7 0 obj
       << /Type /Font
          /Subtype /Type1
          /Name /F1
          /BaseFont /Helvetica
          /Encoding /MacRomanEncoding
       >>
    endobj
    xref
    0 8
    0000000000 65535 f
    0000000009 00000 n
    0000000074 00000 n
    0000000120 00000 n
    0000000179 00000 n
    0000000364 00000 n
    0000000466 00000 n
    0000000496 00000 n
    trailer
       << /Size 8
          /Root 1 0 R
       >>
    startxref
    625
    %%EOF

    Hi, Irosenth and others again.
    To try to solve my problem (because I do not know how to do this in PDF), I made a short PostScript program to check the length of the characters in Helvetiva 10 pt. A part of the program is shown below. If I have the length, I can calculate the centered position of the text in my C or Fortran program, that makes the PDF file.  This investigation gave, for instance, the lengths for A, B and W as:
    A:  6.66797
    F:  6.10840
    W: 9.43945
    When I placed the EPS file into Adobe InDesign a bit different values came out:
    A:  6.66959
    F:  6.10963
    W: 9.43942
    ... and still different in Adobe Photoshop:
    A:  6.67081
    F:  6.11075
    W: 9.44115
    I have the feeling that character lengths are given as integers in the font file (not as real numbers) and I actually have to multiply these lengths (for 10 pt. Helvetica)  with some unknown value to find the "correct" lengths of the given characters. Does anyone know the actual length of the character A in Helvetica for instance?
    PostScript program:
    /Helvetica findfont
    dup length dict begin
      {1 index /FID ne {def} {pop pop} ifelse} forall
      /Encoding ISOLatin1Encoding def
      currentdict
    end
    /Helvetica-ANSI exch definefont pop
    gsave
    /str 20 string def
    /Helvetica-ANSI findfont 10 scalefont setfont
    (A ) 50  750 moveto show
    (A)  stringwidth pop str cvs  80 750 moveto show
    (F ) 50  700 moveto show
    (F)  stringwidth pop str cvs  80 700 moveto show
    (W ) 50  650 moveto show
    (W)  stringwidth pop str cvs  80 650 moveto show
    grestore

  • Help with excel to applet

    don't know why i have a error
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.Applet;
    import java.awt.Button;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Frame;
    import java.awt.Graphics;
    import java.awt.Image;
    import java.awt.Insets;
    import java.awt.Label;
    import java.awt.LayoutManager;
    import java.awt.TextArea;
    import java.awt.TextField;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.JOptionPane;
    import java.text.*;
    import java.awt.Choice;
    import java.io.*;
    import java.net.*;
    import java.sql.*;
    import java.util.*;
    public class MortgageAppletGUI extends Applet {
             Button calculateButton;
             Button clearButton;
             Button exitButton;
             Button excelButton;
              TextField principalField;
              TextField interestField;
              TextField termField;
              TextArea displayArea;
              Label principal;
              Label term;
              Label interest;
              Image house;
              Font title = new Font("TimesRoman", Font.BOLD, 16);
              Font text = new Font("Courier", Font.BOLD, 12);
              double monthlyInt;
              double monthlyPayment;
              int months=12;
              double interestPayment;
              double principalPayment;
              double remainingBalance;
             Choice principalChoice;
             Choice interestChoice;
             Choice termChoice;
    public static final String DRIVER_NAME =
            "sun.jdbc.odbc.JdbcOdbcDriver";
    public static final String DATABASE_URL = "jdbc:odbc:employee_xls";
    public void init() {
            MortgageAppletLayout customLayout = new MortgageAppletLayout();
              setFont(new Font("Helvetica", Font.PLAIN, 12));
              setLayout(customLayout);
              calculateButton = new Button("Calculate");
              calculateButton.addActionListener(new CalculateActionListener());
              add(calculateButton);
              displayArea = new TextArea();
              add(displayArea);
              principal = new Label("Principal");
              add(principal);
              interest = new Label("Interest");
              add(interest);
              term = new Label("Term");
              add(term);
              clearButton = new Button("Clear");
              clearButton.addActionListener(new CancelActionListener());
              add(clearButton);
              principalField = new TextField(20);
              add(principalField);
              interestField = new TextField(20);
              add(interestField);
              termField = new TextField(20);
              add(termField);
            principalChoice = new Choice();
              principalChoice.addItem("200000");
              principalChoice.addItemListener(new ChoicePrincipal());
            add(principalChoice);
            interestChoice = new Choice();
            interestChoice.addItem("5.35");
            interestChoice.addItem("5.5");
            interestChoice.addItem("5.75");
            interestChoice.addItemListener(new ChoiceInterest());
            add(interestChoice);
            termChoice = new Choice();
            termChoice.addItem("7");
            termChoice.addItem("15");
            termChoice.addItem("30");
            termChoice.addItemListener(new ChoiceTerm());
            add(termChoice);
            exitButton = new Button("Exit");
              exitButton.addActionListener(new ExitActionListener());
              add(exitButton);
            excelButton = new Button("Chart");
              excelButton.addActionListener(new ExcelActionListener());
              add(excelButton);
              setSize(getPreferredSize());
              house = getImage(getCodeBase(), "house.jpg");
    class CalculateActionListener implements ActionListener{
    public void actionPerformed(ActionEvent e) {
              NumberFormat Currency = NumberFormat.getCurrencyInstance();
              String userInputprincipal = principalField.getText();
              String userInputinterest = interestField.getText();
              String userInputterm = termField.getText();
              double userInputprincipalD=0;
              double userInputinterestD=0;
              double userInputtermD=0;
              try {
              userInputprincipalD = Double.parseDouble(userInputprincipal);
              } catch (Exception ex) {
              JOptionPane.showMessageDialog(null, "Error principalField", "Exception 01", JOptionPane.ERROR_MESSAGE);
              principalField.requestFocus();
              return;
              try {
              userInputinterestD = Double.parseDouble(userInputinterest);
              } catch (Exception ex) {
              JOptionPane.showMessageDialog(null, "Error interestField", "Exception 02", JOptionPane.ERROR_MESSAGE);
              interestField.requestFocus();
              return;
              try {
              userInputtermD = Double.parseDouble(userInputterm);
              } catch (Exception ex) {
              JOptionPane.showMessageDialog(null, "Error termField", "Exception 03", JOptionPane.ERROR_MESSAGE);
              termField.requestFocus();
              return;
    // Display principal, interest, and loan balance of entire term
                 double monthlyInt;
                 double monthlyPayment;
                 double interestPayment;
                 double principalPayment;
                 double remainingBalance;
                 double months = userInputtermD * 12;
                 monthlyInt = (userInputinterestD  / 100) / 12;
                 monthlyPayment = (userInputprincipalD * monthlyInt) / (1 - Math.pow(1 / (1 + monthlyInt), userInputtermD  * 12));
                 for (int i = 1; i <= months; ++i) {
             interestPayment = userInputprincipalD * monthlyInt;
             principalPayment = monthlyPayment - interestPayment;
             remainingBalance = userInputprincipalD - principalPayment;
             displayArea.append("\n#" + i + "\tP=" + Currency.format(principalPayment) + "\tI=" + Currency.format(interestPayment)
               + "\tB=" + Currency.format(remainingBalance) + "\n");
             userInputprincipalD -= principalPayment; // calculate until payments are done
    class ExcelActionListener implements ActionListener {
    public void actionPerformed(ActionEvent e) {
          Class.forName(DRIVER_NAME);
          Connection con = null;
          try {
             con = DriverManager.getConnection(DATABASE_URL);
             Statement stmt = con.createStatement();
             ResultSet rs = stmt.executeQuery
             ("select lastname, firstname, id from [Sheet1$]");
             while (rs.next()) {
             String lname = rs.getString(1);
             String fname = rs.getString(2);
             int id = rs.getInt(3);
             displayArea.append(fname + " " + lname + "  id : " + id);
             rs.close();
             stmt.close();
               catch(Exception ex) {
               finally {
              try
            if (con != null)
            con.close();
    catch(SQLException ignored) {
    class CancelActionListener implements ActionListener{
    public void actionPerformed(ActionEvent e) {
              principalField.setText("");
              interestField.setText("");
              termField.setText("");
              displayArea.setText("");
    class ExitActionListener implements ActionListener {
    public void actionPerformed(ActionEvent e){
    System.exit(0);
    class ChoicePrincipal implements ItemListener {
    public void itemStateChanged(ItemEvent ie) {
              Choice cb1 = (Choice)ie.getSource(); // the source of the event is the combo box
              String principalC = (String)cb1.getSelectedItem();
              principalField.setText(principalC);
    class ChoiceInterest implements ItemListener {
    public void itemStateChanged(ItemEvent ie) {
              Choice cb1 = (Choice)ie.getSource(); // the source of the event is the combo box
              String interestC = (String)cb1.getSelectedItem();
              interestField.setText(interestC);
    class ChoiceTerm implements ItemListener {
    public void itemStateChanged(ItemEvent ie) {
              Choice cb1 = (Choice)ie.getSource(); // the source of the event is the combo box
              String termC = (String)cb1.getSelectedItem();
              termField.setText(termC);
    public void paint(Graphics g) {
              // Display program info
              g.drawImage(house, 10, 5, this);
              g.setColor(Color.green);
              g.drawLine(20, 4, 230, 4);
              g.setColor(Color.red);
              g.setFont(title);
              g.drawString("\tMortgage Loan Calculator", 10, 17);
              g.setColor(Color.black);
              g.setFont(text);
              g.drawString("\tCreated by Me", 10, 30);
    public static void main(String args[]) {
            MortgageAppletGUI applet = new MortgageAppletGUI();
            Frame window = new Frame("MortgageApplet");
            window.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
            System.exit(0);
            applet.init();
            window.add("Center", applet);
            window.pack();
            window.setVisible(true);
    class MortgageAppletLayout implements LayoutManager {
        public MortgageAppletLayout() {
        public void addLayoutComponent(String name, Component comp) {
        public void removeLayoutComponent(Component comp) {
        public Dimension preferredLayoutSize(Container parent) {
            Dimension dim = new Dimension(0, 0);
            Insets insets = parent.getInsets();
            dim.width = 648 + insets.left + insets.right;
            dim.height = 375 + insets.top + insets.bottom;
            return dim;
        public Dimension minimumLayoutSize(Container parent) {
            Dimension dim = new Dimension(0, 0);
            return dim;
        public void layoutContainer(Container parent) {
            Insets insets = parent.getInsets();
            Component c;
            c = parent.getComponent(0);
            if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+280,72,24);}
            c = parent.getComponent(1);
            if (c.isVisible()) {c.setBounds(insets.left+248,insets.top+88,328,216);}
            c = parent.getComponent(2);
            if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+104,72,24);}
            c = parent.getComponent(3);
            if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+152,72,24);}
            c = parent.getComponent(4);
            if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+128,72,24);}
            c = parent.getComponent(5);
            if (c.isVisible()) {c.setBounds(insets.left+88,insets.top+280,72,24);}
            c = parent.getComponent(6);
            if (c.isVisible()) {c.setBounds(insets.left+80,insets.top+104,72,24);}
            c = parent.getComponent(7);
            if (c.isVisible()) {c.setBounds(insets.left+80,insets.top+128,72,24);}
            c = parent.getComponent(8);
            if (c.isVisible()) {c.setBounds(insets.left+80,insets.top+152,72,24);}
            c = parent.getComponent(9);
            if (c.isVisible()) {c.setBounds(insets.left+152,insets.top+104,72,24);}
            c = parent.getComponent(10);
            if (c.isVisible()) {c.setBounds(insets.left+152,insets.top+128,72,24);}
            c = parent.getComponent(11);
            if (c.isVisible()) {c.setBounds(insets.left+152,insets.top+152,72,24);}
            c = parent.getComponent(12);
            if (c.isVisible()) {c.setBounds(insets.left+172,insets.top+280,50,24);}
                c = parent.getComponent(13);
            if (c.isVisible()) {c.setBounds(insets.left+172,insets.top+380,50,24);}
    }

    The only concern I would have in that is that sometimes there are preparatory or cleanup methods invoked behind the scenes before or after the method you write. For example, you never call myThread.run(), you call myThread.start();
    I tried pasting your code into Eclipse but Eclipse gave lots of errors. And in order to investigate these errors, I'd have to be able to read your code, but you have no indentations so it's a bit hard to do.

  • Output to a text file in an applet...

    i can't figure out how to do output to a text file in an applet... i've gotten output in applications, but nto applets. if someone can give me a link to a site that explains this, i would be much appreciative.

    There is no easy way, since accessing Files with write permissions is a security issue. You can sign the JAR your applet is in, and use Security managers to try and get around it, but it is quite complicated I believe.
    Do a search for Security Signed Applets etc...

  • Sing text with certificate from Firefox keystore

    Hi,
    I need to sign a text with a certificate stored in Firefox keystore using an applet (online signature). Has someone achieved this before?
    Thanks in advance.

    http://finger-in-the-eye.blogspot.com/2007/03/cmo-acceder-al-keystore-de-firefox-con.html

  • Design Canvas & Centering text

    Forgive me for being a noob here but I have a couple of questions :-
    1.) How do I undock the design canvas so I can use it full screen ? At the moment, everything will only snap to the grid that is the displayed part of the design canvas - not the whole screen.
    2.) How do I centre text on the screen for instance a heading ? I've used 'text-align: center' but that of course just justifies in the output text box - not the screen.
    SPG

    (1) At the moment there's no way to do that with a single gesture, but we're merging the NetBeans 4.0 window manager so in the future that will be easy.
    For now, you can click on the "pushpin"-like icon near the top of the properties and project navigator window to cause them to slide out to the right.
    (2) To get centering like this, don't use absolute positioning. Here's what you can do: go to the Source tab, and add something like this (under body or form depending on where you want it):
    <p style="text-align: center"> Hello World! </p>
    (or use h1, h2, ... instead of p.) Output Text renders a span which is an inline tag, so you can't set the text-align directly on it. If you want to use an output text (for example to value bind it), you can first add an output text (but DON'T absolute position it: either double click on the output text item in the palette, or drop it and then go remove its position, left and top properties from the style property of the output text). Then go to the source tab, locate the h:outputText you've dropped, and add a <p style="text-align: center"> right before it and </p> right after it, e.g. "wrap the output text with a p block tag).
    Hope that helps.
    -- Tor
    http://blogs.sun.com/tor

  • I cant transform my text to 3d text with my photoshop cc what can i do? all 3d options seem to be blocked

    hello i cant transform my text to 3d text with my photoshop cc what can i do? all 3d options seem to be blocked

    Also check your system's capabilities against the Adobe Photoshop requirements:
    System requirements | Photoshop
    -Noel

  • How to email text from a text component in my applet on a the host server ?

    How to email text from a text component in my applet on a the host server, back to my email address ?
    Assuming I have Email Form on the host server.
    Help will be appreciated.

    You can do like below
    =REPLACE(Fields!Column.Value," " & Parameters!ParameterName.value & " ","<b>" & Parameters!ParameterName.value & "</b>")
    The select the expression and  right click and choose placeholder properties
    Inside that set Markup type as HTML 
    then it will highlight the passed parameter value in bold within the full xml string
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Maybe you are looking for

  • Values not getting displayed from first page of the report.

    Values in the report is getting displayed from second page. First page in the report only displaying the report title and column names. Secone page onwards, data and column names are generated. Can any one please help me, with the cause of the proble

  • "Last Played" won't update on iTunes-purchased songs

    I've had great joy using the variable "Least Recently Played" to create Smart Playlists. But certain things are not updating properly now, with 10.5.3.3 Here's the table: Ripped Music, iPod Touch Gen 3:  UPDATES PROPERLY. Ripped Music, played in Win7

  • Query or function that returns distinct values and counts

    For the following table: ID number address varchar(100) Where the ID is the primary key and addresses might be repeated in other rows, I'd like to write a query that returns distinct addresses and the count for the number of times the address exists

  • Bank guarantee with MIRO

    Hi All, We have made a Vendor Bank Guarantee through F-57 with spl G/L indicator. Ran FBL1N to see the list of bank Guarantess for a particular vendor where the due date i.e. expiry date of bank Guarantee is also displayed. Now at the time of MIRO/Ad

  • Whether to go for bdc or user exits???

    hi, I have a reqirement like given below how should i proceed plz help me out. If pre-tax contribution percentage in field EEPCT from table P0169  is less than 6%, only first sequence of  customizing table V_74FF_C should run. It means, for employer