Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #28194

Re: Java Swing text as a grid?

Newsgroups comp.lang.java.programmer
Date 2014-04-23 00:56 -0700
References <8c3ea48c-26d5-4ef8-869b-08f46023b953@googlegroups.com> <lj62s5$buc$1@dont-email.me> <lj6eet$66e$1@dont-email.me>
Message-ID <3cc8ce8c-ee9c-430e-8c3d-efdf95bb7150@googlegroups.com> (permalink)
Subject Re: Java Swing text as a grid?
From Rupert Smith <rupertlssmith@googlemail.com>

Show all headers | View raw


On Tuesday, April 22, 2014 8:03:25 PM UTC+1, Jeff Higgins wrote:
> On 04/22/2014 11:45 AM, Jeff Higgins wrote:
> You might look at the source of javax.swing.text.PlainView after
> you've got your document model completely worked out.

PlainView: The view represents each child element as a line of text.

Sounds like its pretty close to what I'm after, thanks.

> > javax.swing.text is a big, and to my mind, complex package.

Its a beast for sure. 6 chapters in the Swing text book I have, and even that doesn't leave room for the details.

I looked an lanterna and realised that rendering a simple grid of text can be as simple as implementing paintComponent()

for (int i = 0; i < columns; i++) {
  for (int j = 0; j < rows; j++) {
    graphics2d.drawString(characters[j][i], ...

So I think I will keep the model very simple for now, and render that way. I can re-implement on top of text.Document and play around with text.View as and when more capability is required.

Rupert

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Java Swing text as a grid? rupertlssmith@googlemail.com - 2014-04-22 07:50 -0700
  Re: Java Swing text as a grid? markspace <markspace@nospam.nospam> - 2014-04-22 08:22 -0700
  Re: Java Swing text as a grid? Jeff Higgins <jeff@invalid.invalid> - 2014-04-22 11:45 -0400
    Re: Java Swing text as a grid? Jeff Higgins <jeff@invalid.invalid> - 2014-04-22 15:03 -0400
      Re: Java Swing text as a grid? Rupert Smith <rupertlssmith@googlemail.com> - 2014-04-23 00:56 -0700
  Re: Java Swing text as a grid? Roedy Green <see_website@mindprod.com.invalid> - 2014-04-23 19:49 -0700
    Re: Java Swing text as a grid? Rupert Smith <rupertlssmith@googlemail.com> - 2014-04-25 02:13 -0700
      Re: Java Swing text as a grid? Arne Vajhøj <arne@vajhoej.dk> - 2014-04-28 20:26 -0400

csiph-web