Dell Released

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Wednesday, August 28, 2013

how to add jscrollpane to jframe?

Posted on 12:10 AM by Unknown
how to add jscrollpane to jframe?



I have following source code...Can someone please give me an advice how to

add jscrollpane onto jframe? I tried several time to add it to jframe but

without any progress. It is not even showing.

public class Form3 {

JFrame jframe = new JFrame("Etiket print.");

JPanel panel1 = new JPanel();

JPanel panel2 = new JPanel();

JPanel panel3 = new JPanel();

JPanel panel4 = new JPanel();

JScrollPane scrollFrame = new JScrollPane(panel2);

Color myBlue1Color = new Color(168, 175, 247);

Color myBlue2Color = new Color(139, 146, 255);

public Form3(){

jframe.setMinimumSize(new Dimension(1280, 1000));

panel2.setLayout(new BoxLayout(panel2, BoxLayout.Y_AXIS));

panel2.setAutoscrolls(true);

jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//---------------------------------Header

panel1 = createSquareJPanel(Color.YELLOW, 600,200);

panel3 = createSquareJPanel(Color.GREEN, 400,200);

panel4 = createSquareJPanel(Color.white, 280,200);

JPanel container = new JPanel();

JPanel container1 = new JPanel();

JPanel container2 = new JPanel();

container.setLayout(new BoxLayout(container,

BoxLayout.Y_AXIS));

container1.setLayout(new BoxLayout(container1,

BoxLayout.Y_AXIS));

container2.setLayout(new BoxLayout(container2,

BoxLayout.X_AXIS));

container1.add(panel1);

container2.add(container1);

container2.add(panel3);

container2.add(panel4);

container.add(container2);

container.add(panel2);

{

for (int i=0; i<25; i++){

JPanel harnessPanel= new JPanel();

harnessPanel.setMinimumSize(new Dimension(1280, 70));

harnessPanel.setMaximumSize(new Dimension(1280, 70));

harnessPanel.setPreferredSize(new Dimension(1280,

70));

if(i%2==0) {

harnessPanel.setBackground(myBlue1Color);

}

else {

harnessPanel.setBackground(myBlue2Color);

}

panel2.add(harnessPanel);

harnessPanel.repaint();

harnessPanel.validate();

}

panel2.repaint();

panel2.validate();

}

jframe.add(scrollFrame);

jframe.add(container);

jframe.pack();

jframe.setLocationRelativeTo(null);

jframe.setVisible(true);

}

private JPanel createSquareJPanel(Color color, int size1, int

size2)

{

JPanel tempPanel = new JPanel();

tempPanel.setBackground(color);

tempPanel.setMinimumSize(new Dimension(size1, size2));

tempPanel.setMaximumSize(new Dimension(size1, size2));

tempPanel.setPreferredSize(new Dimension(size1, size2));

return tempPanel;

}

public static void main (String args[]){

SwingUtilities.invokeLater(new Runnable() {

@Override

public void run() {

Form3 myF=new Form3();

}

});

};

}

picture of my app:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • The Google Visualization API Query Language: Query parse error: Encountered " "," ", "" at line 1, column 24. Was expecting one of:
    The Google Visualization API Query Language: Query parse error: Encountered " "," ", "" at line 1, column 24. ...
  • fanotify unable monitor entire system for FAN_OPEN_PERM event by multi-threaded program, and to ignore directories
    fanotify unable monitor entire system for FAN_OPEN_PERM event by multi-threaded program, and to ignore directories I want to monitor whole s...
  • URL constantly results in a badbox
    URL constantly results in a badbox I am trying to insert a long url into a latex document. I'm using hyperref package to make them click...
  • How to properly provide data for ?
    How to properly provide data for ? I am serving binary data for HTML5 audio thorough .aspx page. The file can be played but there is a probl...
  • filtration on the cohomology of a complex
    filtration on the cohomology of a complex Let $K^\bullet$ be a complex and let $F_I$ and $F_{II}$ be two filtrations on it. suppose $F_I^i K...
  • Should I make multiple SQLite databases for better concurrency?
    Should I make multiple SQLite databases for better concurrency? I'm very new to SQL and relational databases (just started learning last...
  • How do I position a div on top of another div
    How do I position a div on top of another div The post on my website are set to show information regarding the post when the mouse hovers ov...
  • Udated Streak 7 Manual & Quick Start Guide With Honeycomb
    For those of you who bought the Streak 7 before the Honeycomb 3.2 update, you have in your possession an out of date Manual & Quick Star...
  • Remove/avoid adding target link to URL
    Remove/avoid adding target link to URL This one may be simple for the jQuery/JavaScript gurus here, but I just can't find a solution for...
  • Cannot connect to SQL Server 2012
    Cannot connect to SQL Server 2012 I'm trying to connect to a SQL Server 2012 database using C#, both the server and program are on the s...

Categories

  • Games
  • News
  • Streak 5
  • Streak 7
  • Tips

Blog Archive

  • ▼  2013 (124)
    • ▼  August (124)
      • Should I make multiple SQLite databases for better...
      • Difference between Nil and nil and Null in Objecti...
      • Cannot connect to SQL Server 2012
      • Android - error opening file just created
      • PHP SimpleXML doesn't output anything
      • Memory leak (igraph, watts.strogatz.game, get.all....
      • How do I position a div on top of another div
      • Updating foreign key references on the DbContext C...
      • Convert string to DateTime and format
      • call function on click outside of a particular div
      • OperationalError when inserting into sqlite 3 in P...
      • Trying to print a string character by character wi...
      • I need to make my JPanel resize dynamically as new...
      • How to retrieve images from cache memory?
      • how to add jscrollpane to jframe?
      • Query on how to Select Date before the latest Date...
      • Does archive size of tar, zip and rar effect the t...
      • How do I make a DOM object follow a circular path ...
      • how to use for loop for my issue
      • AngularJS - Pass variable from a controller & upda...
      • Windows 2012: how to make power button work in eve...
      • IN OBOUT grid, how to move from first grid to anot...
      • Am I using the form action correctly?
      • Increasing the font size of a webview conflict wit...
      • quicktags "link" button doesn't work, but all othe...
      • Cannot access local variables using systemtap
      • Remove/avoid adding target link to URL
      • Left-justified equations with left tags (so it loo...
      • [ Marriage & Divorce ] Open Question : My boyfrien...
      • livetv2pc)))WaTch (Rugby) Australia vs New Zealand...
      • The Google Visualization API Query Language: Query...
      • iOS 7 phone-number link doesn't work when webpage ...
      • Cross-browser textarea maxlength
      • candied mints storage and transporting long distance
      • how to convert objectHTML into html
      • Mellin transform definition
      • Multiple Google Calendars with one Google Cal ID
      • Dell PowerEdge 2950 PCIe Training Error -- No PCIe...
      • Reset Disk - Windows Storage Server 2012
      • Windows Phone 8 - Keeping background location trac...
      • Django forms design suggestiom
      • Magento Upgrade, getting error with tier prices fr...
      • Bouncing between "Adapter is detached" and "No wra...
      • How to create overlapping - not stacking - shapes ...
      • Enclosing capsules around list based arrays [on hold]
      • Identifying Switch case argument (Perl)
      • asp.net ModalPopupExtender not behaving properly
      • fanotify unable monitor entire system for FAN_OPEN...
      • Jquery UI datepicker inline "onclick" handler caus...
      • URL constantly results in a badbox
      • Split values over multiple rows with different del...
      • How to aggregate data without group by
      • Angular $scope.$watch on (for in... ) don't work
      • Using Modernizr to test browser support for css ca...
      • Content overlapping in navigation menu?
      • cls file - multiple files
      • Differences between "fortification nouns"
      • filtration on the cohomology of a complex
      • Problems with every aspect of facebook that involv...
      • Extract data from last line in a text file using PHP
      • How to properly provide data for ?
      • ConditionalPanel doesn't support variables with do...
      • Frequent out of memory issues
      • Undefine reference for libraries, so How could I f...
      • radio buttons checked with jquery not holding prop...
      • How to modify bash command to change permissions
      • header(Content-type: image/jpeg) not working
      • Removing smart quotes from an SQL server text column
      • Getting out of sync server response
      • thesis work" vs "thesis
      • php radio post wrong same value after submit
      • Several questions about trigonometry and functions
      • A div that adapts to its background
      • Why are there two different versions of the mean a...
      • Restore only some volumes from a multiOS system image
      • system of pde (solid mechanics)
      • Application or Object defined error - VBA Excel 2013
      • Deleting the last few revisions: SVN best practice
      • Choose blackberry 10 platform to use call logs, me...
      • Procedure or function usp_logout has too many argu...
      • how can i use combination of unix signals (like SI...
      • Basic Javascript Countdown Timer Taking Longer Tha...
      • WordPress Guest Author - How can I use custom fiel...
      • button to generate html delete method?
      • socket.io redis ECONNREFUSED
      • Can one http request call multiple css files?
      • .htaccess related codeigniter. why error 404 page ...
      • Undefined symbols error from static framework
      • XML Sitemap Generator for URL with 1.5 million pages?
      • How do I prevent Microsoft DNS from reporting vers...
      • Solve the equation for x, y and z: $\sqrt{x-y+z}=\...
      • A basic doubt on linear dependence of vectors
      • mysql charsets, can I perform the conversion in py...
      • Mirrors Edge video settings are locked
      • Receiving null messages on android, how to fix it?
      • changing an onEdit function to run onOpen
      • Handle Multiple Form tag in asp.net page?
      • Getting click event on parent page of button in frame
      • Fix column width with tabularx
      • best software to use to make a website
  • ►  2012 (6)
    • ►  February (2)
    • ►  January (4)
  • ►  2011 (10)
    • ►  December (1)
    • ►  November (2)
    • ►  October (7)
Powered by Blogger.

About Me

Unknown
View my complete profile