Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

AWT control like Detail view in Win95

Posted on 1997-05-05
2
Medium Priority
?
178 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
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

927 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