import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.SwingWorker;
+import javax.swing.border.EmptyBorder;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.fanfix.library.BasicLibrary;
this.setLayout(new BorderLayout());
this.setTitle(meta.getTitle());
- this.add(new JLabel("Waiting for " + meta.getTitle() + "..."),
- BorderLayout.NORTH);
+ JLabel waitingTextLabel = new JLabel("Waiting for " + meta.getTitle() + "...");
+ waitingTextLabel.setHorizontalAlignment(JLabel.CENTER);
+ waitingTextLabel.setBorder(new EmptyBorder(30, 10, 10, 10));
+ this.add(waitingTextLabel, BorderLayout.NORTH);
imgLabel = new JLabel();
imgLabel.setPreferredSize(new Dimension(CoverImager.getCoverWidth(),
CoverImager.getCoverHeight()));
+ imgLabel.setHorizontalAlignment(JLabel.CENTER);
this.add(imgLabel, BorderLayout.CENTER);
// Image
}
}.execute();
+ UiHelper.setFrameIcon(this, lib, meta);
this.setSize(400, 300);
}
}
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JToolBar;
+import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import be.nikiroo.fanfix.Instance;
worker.start();
initGui();
- display(index, Rotation.NONE, true);
- if (!images.isEmpty()) {
- UiHelper.setFrameIcon(this, images.get(0));
- }
+ // The first part of display() needs the scroll to be positioned
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ // ...now it is
+ display(index, Rotation.NONE, true);
+ }
+ });
+
+ UiHelper.setFrameIcon(this, images.isEmpty() ? null : images.get(0));
}
private void initGui() {
import java.awt.BorderLayout;
import java.awt.Color;
-import java.awt.Dimension;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
private NavBar navbar;
private JLabel title;
private JScrollPane scroll;
- private JPanel mainPane;
private JEditorPane area;
private JPanel descPane;
initGui(lib);
setChapter(0);
- UiHelper.setFrameIcon(this);
+ UiHelper.setFrameIcon(this, lib, story.getMeta());
}
/**