Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6659097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:59:30+00:00 2026-05-26T01:59:30+00:00

I have a Container whose Layout is BorderLayout. I want to draw a horizontal

  • 0

I have a Container whose Layout is BorderLayout. I want to draw a horizontal line at the SOUTH position because this Container is drawn repeatedly so I want to delimit each by the horizontal line.

Here is the code:

tList = new List(tModel);
tList.setListCellRenderer(new CTable(listclient));

public class CTable extends Container implements ListCellRenderer {

  private Label pic = new Label("");
  private Container cnt;
  private Label name = new Label("");
  private Label credit = new Label("");
  private ligneHorizontal ligne;

  private Font fontLibelle = (MenuPrincipalForm.r).getFont("FontTextFieldBold");

  private Label focus = new Label("");

  public CTable(Vector valeur)
  {
      setLayout(new BorderLayout());
      addComponent(BorderLayout.WEST, pic);
      cnt = new Container(new BoxLayout(BoxLayout.Y_AXIS));
      name.getStyle().setBgTransparency(0);
      name.getStyle().setFont(fontLibelle);
      credit.getStyle().setBgTransparency(0);
      cnt.addComponent(name);
      cnt.addComponent(credit);
      ligne = new ligneHorizontal(100);
      cnt.addComponent(ligne);
      addComponent(BorderLayout.CENTER, cnt);
      focus.getStyle().setBgTransparency(100);
  }

  public Component getListCellRendererComponent(List list, Object value, int index, boolean isSelected)
  {
      if ("-".equalsIgnoreCase(String.valueOf(value)))
      {
          name.setText(" - ");
          credit.setText("Encours : -  Impayés : -");
          pic.setIcon(null);
      }
      else
      {
          if (index%2 == 0)
              this.setUIID("evenRowsCell");
          else
              this.setUIID("oddRowsCell");
          name.setText("123456789012 - Rasolofomanana Marc");
          credit.setText("Crédits : 15.000 (Ar) Impayés : 10.000 (Ar)");
          pic.setIcon(null);
      }
      return this;
  }
  public Component getListFocusComponent(List list)
  {
      return focus;
  }
}

public class ligneHorizontal extends Label {
    public ligneHorizontal(int l)
    {
        String t = "";
        do
        {
            t.concat(new String("-"));
        }
        while(t.length()<l);
        this.setText(t);
        this.setPreferredH(5);
        this.getStyle().setBgColor(0);
    }
}

And also I want to know how to coloriate even rows and odd rows of the List because I tried but the color is not get until I click on the cell.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:59:31+00:00Added an answer on May 26, 2026 at 1:59 am

    Ok , I found the solution : I derived BackgroundPainter where in the public void paint(Graphics g,Rectangle rect) method I draw the line ( g.drawLine(rect.getX(), rect.getY()+h-1, rect.getX()+w, rect.getY()+h-1); ).
    So when I want to draw a line in the container then I write myContainer.getStyle().setBgPainter(new derivedClassName(myContainer));

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a container filled with pairs. I want to iterate in it using
I have an activity whose layout only contains a VideoView. Here is the xml:
I have an Activity whose layout is in the file main.xml that contains a
I want a two-column div layout, where each one can have variable width e.g.
Reporting Services 2005 My layout is like this: I have the mainreport which contains
I want to put 8 image thumbs in one horizontal line, using the whole
I have a DialogFragment (displayed as a dialog) whose layout contains a WebView control.
I have a simple layout that consists of a #container with #container { width:
i have some troubles implementing this layout: http://deconcini.net/maurer-schneebacher/projekte/elisabethinum.html Basically i would like to display
I have the following in my application layout page <body> <div class=container showgrid> <%=

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.