Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Fill calendar to full screen (Read 3650 times)
AncaZ
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Feb 16th, 2017
Fill calendar to full screen
Apr 27th, 2017 at 7:03am
Print Post  
Hello,

How can I set the calendar to have to fill all the screen.
This what I have tried:
Code (Java)
Select All
final AwtCalendar calendar = createCalendar();
        JPanel entryPanel = PanelFactory.createBorderedPanel(new GridBagLayout(), "Agenda");
        this.setLayout(new BorderLayout());

        JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
        buttonPanel.add(btOpslaan);

        JPanel calendarPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
        calendarPanel.add(calendar);

        entryPanel.add(calendarPanel);
        JScrollPane sp = new JScrollPane(entryPanel);
        sp.setBorder(null);
        add(sp, BorderLayout.CENTER);
        add(buttonPanel, BorderLayout.SOUTH);
 



Thank you
  

Untitled.png ( 9 KB | 232 Downloads )
Untitled.png
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Fill calendar to full screen
Reply #1 - Apr 27th, 2017 at 12:22pm
Print Post  
The calendar can fit inside any size and does not override Java's preferred-size value, so layouts that keep components' preferred size won't work. Try replacing with BorderedLayout.CENTER to force the calendar to occupy all available space available to parent panel -

Code
Select All
getContentPane().setLayout(new BorderLayout());

JPanel entryPanel = new JPanel(new BorderLayout());

JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
buttonPanel.add(btOpslaan);


/*
JPanel calendarPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
calendarPanel.add(calendar );  */

// BorderLayout.CENTER fill all available space
JPanel calendarPanel = new JPanel(new BorderLayout());
calendarPanel.add(calendar, BorderLayout.CENTER);

entryPanel.add(calendarPanel, BorderLayout.CENTER);

JScrollPane sp = new JScrollPane(calendarPanel);
sp.setBorder(null);

getContentPane().add(buttonPanel, BorderLayout.SOUTH);
getContentPane().add(sp, BorderLayout.CENTER); 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint