Solved

AWT control like Detail view in Win95

Posted on 1997-05-05
2
171 Views
Last Modified: 2010-04-16
Is there a set of Java classes that can offer more visual control like a detail view in Win95. I need a control that can hold multiple column of data.

Thanks
0
Comment
Question by:pjroy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Expert Comment

by:jpk041897
ID: 1220127
Not sure if this will help, but the following code is for a multiple coliumn list box:

class ScrollPanel extends Panel {
  Vector values;
  Font f;
  FontMetrics fm;
  int ma, md, lines, topOfList;

  ScrollPanel(int lines) {
  f = new Font("Helvetica", Font.PLAIN, 14);
  fm = getFontMetrics(f);
  ma = fm.getMaxAscent();
  md = fm.getMaxDescent();
  this.lines = lines;
  topOfList = 0;
  values = new Vector();
}

public Dimension minimumSize() {
  return new Dimension(0, (ma + md) * lines);
}

public void paint(Graphics g) {  

  g.clearRect(0, 0, size().width, size().height);
  int y = ma;
  int lineHeight = ma + md;

  int limit = (size().height / lineHeight);
  if (limit > (values.size() - topOfList)) {
    limit = (values.size() - topOfList);
  }
  g.setFont(f);
  for (int i = topOfList; i < (topOfList + limit); ++i) {
    g.drawString((String)values.elementAt(i), 5, y);
    y += lineHeight;
  }
}

public void clear() {
  values.removeAllElements();
}

public void addItem(String s) {
  values.addElement(s);
}

public void scrollTo(int pos) {
  topOfList = pos;
  repaint();
}

public int maxScroll() {
  int ms = values.size() - lines;

  if (ms < 0) {
    return 0;
  } else {
    return ms;
   }
 }
}


0
 
LVL 1

Accepted Solution

by:
Arkadiy earned 0 total points
ID: 1220128
Almost any class library offers sometnhing like column list. I use the one from Microline Software. Go to http://www.neurondata.com/ and select Products.
However, if you have time, you may want to wait for JFC from JavaSoft. That toolkit will eventualy become a part of AWT.
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Custom Java Application connects to database: Which one of the 20? 4 59
going to wrong jsp page 2 70
ejb mdb examples 1 39
Crystal Reports Licensing Questions 4 87
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question