Added componentResized
This commit is contained in:
@@ -35,7 +35,7 @@ public class Main {
|
||||
|
||||
agn.fillArtists();
|
||||
agn.fillStages();
|
||||
w.updatePanel("table");
|
||||
w.updatePanel("timeline");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-1
@@ -51,9 +51,14 @@ public class Timeline extends JPanel
|
||||
|
||||
genStages();
|
||||
this.setSize(frame.getWidth(), frame.getHeight());
|
||||
refresh();
|
||||
// refresh();
|
||||
|
||||
}
|
||||
|
||||
public void setEvents(ArrayList<Event> events)
|
||||
{
|
||||
this.events = events;
|
||||
}
|
||||
|
||||
public void refresh()
|
||||
{
|
||||
|
||||
+7
-1
@@ -27,8 +27,14 @@ public class TimelinePanel extends JPanel implements Panel {
|
||||
@Override
|
||||
public void update(ArrayList<Event> event)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
timeline.setEvents(event);
|
||||
timeline.refresh();
|
||||
|
||||
}
|
||||
|
||||
public TimelinePanel getTimelinePanel()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import java.awt.FlowLayout;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -166,6 +168,13 @@ public class Window extends JFrame {
|
||||
|
||||
//Show window
|
||||
setVisible(true);
|
||||
this.getRootPane().addComponentListener(new ComponentAdapter()
|
||||
{
|
||||
public void componentResized(ComponentEvent e) {
|
||||
TimelinePanel tempTimeLine = (TimelinePanel) timeline;
|
||||
tempTimeLine.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void updatePanel(String panel)
|
||||
|
||||
Reference in New Issue
Block a user