Results 1 to 5 of 5
  1. #1
    AcousticBruce is offline Senior Member
    Join Date
    Dec 2010
    Location
    Indiana
    Posts
    202
    Rep Power
    4

    Default A create a print view with grids.

    I have a blank white page on the left side of the GUI (this is called PageView class). And on the right side (ChordTabPane class) is some options and Add button and a small window of a user defined Chord Diagram (guitar).

    What I would like is when the user clicks the "Add" button it add the chord to the page on the left side, PageView class. The current view I am working on is a 3X3 grid. That allows 9 Chord Diagrams to be on the page. The purpose is to be able to print these for quick chord references.

    I am trying to figure out how to create a reasonable Object[][] that will fill in the selected Grid size on the PageView area. I imagine in this Object[][] it should be a user defined JPanel chord grid.


    My main question is...

    Would it be better to create a new JPanel class that would fit in a Object[][] and copy information from the user defined chord grid?

    Or would it be better to just store information in the Array[][] and have the PageView paintComponent draw it out?


    Thank you in advance this forum is always so good.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    I don't see a need to extend JPanel, but rather to use a JPanel that uses a GridLayout. It could hold 9 JLabels, and each JLabel could hold an ImageIcon that holds a BufferedImage of a chord diagram.

  3. #3
    NRitH is offline Senior Member
    Join Date
    Feb 2011
    Posts
    118
    Rep Power
    0

    Default

    Quote Originally Posted by AcousticBruce View Post
    My main question is...

    Would it be better to create a new JPanel class that would fit in a Object[][] and copy information from the user defined chord grid?

    Or would it be better to just store information in the Array[][] and have the PageView paintComponent draw it out?
    In general, the latter is preferable, because it separates the data (the model) from the display (the view). But based on what you wrote, it sounds like the chord panels don't change once they're placed in the grid, so why hold on to them in a 2D array at all?

  4. #4
    NRitH is offline Senior Member
    Join Date
    Feb 2011
    Posts
    118
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    I don't see a need to extend JPanel, but rather to use a JPanel that uses a GridLayout. It could hold 9 JLabels, and each JLabel could hold an ImageIcon that holds a BufferedImage of a chord diagram.
    This.
    This. (10-char minimum post)

  5. #5
    AcousticBruce is offline Senior Member
    Join Date
    Dec 2010
    Location
    Indiana
    Posts
    202
    Rep Power
    4

    Default

    Fubarable - I am coming from the perspective that I want to print the sheet on the left it is a gray background with a WHITE paper that is EXACT spec to a sheet of paper, I just want to print that too the page. So it is essentially a JPanel with an overridden paintComponet to draw a piece of paper. Are you saying with GridLayout (or GridBag because of ability to use multiple units) add JPanels on top of that ?

    NRiTH - I figured since this is an EXACT detail view of the print job I want, I need to recreate the image by just drawing lines. The problem with a buffered image (or what I think is the problem) is it might take too much ink. I have this picture on the right that is a different color and design then I want on the PrintPage. I basically need to redraw on that page on the left only the most basic elements of the Chord Diagram and that is the frets and strings and fretted notes (and finger numbers or alphabet if wanted).

Similar Threads

  1. Replies: 1
    Last Post: 03-12-2009, 12:51 PM
  2. java grids
    By mayhewj7 in forum New To Java
    Replies: 1
    Last Post: 01-26-2009, 04:33 AM
  3. How to create Folder View
    By jazz2k8 in forum Advanced Java
    Replies: 2
    Last Post: 10-24-2008, 03:04 PM
  4. How to create tree view of the given JList implementation
    By aneesahamedaa in forum AWT / Swing
    Replies: 3
    Last Post: 10-06-2008, 03:45 PM
  5. Create view of files in java-Swing
    By Albert in forum AWT / Swing
    Replies: 1
    Last Post: 07-06-2007, 07:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •