Hi Leute,
ich lade eine html Datei ein und geb sie aus, da die aber ewig lang ist möchte ich eine ScrollPane hizufügen ...
das funzt aber nicht keine exception nichts wird einfach nicht angezeigt
ich lade eine html Datei ein und geb sie aus, da die aber ewig lang ist möchte ich eine ScrollPane hizufügen ...
das funzt aber nicht keine exception nichts wird einfach nicht angezeigt
Java:
private JFrame rulesFrame = new JFrame();
private JEditorPane html;
/**
* Displays the Uno Rules in a new JFrame
* @throws IOException
*/
public GuiRules() throws IOException{
displayRules();
}
private void displayRules() throws IOException{
loadRulesPanel();
URL url = rules.ReturnRules.loadRules();
this.html.setPage(url);
}
private void loadRulesPanel(){
this.rulesFrame.setTitle("UNO Help Screen");
this.rulesFrame.setResizable(false);
JPanel rulesPanel = new JPanel();
rulesPanel.setPreferredSize(new Dimension(GuiStaticVars.getUnoWidth(),GuiStaticVars.getUnoHeight()));
rulesFrame.add(rulesPanel);
//Edior Panel
this.html = new JEditorPane();
this.html.setPreferredSize(new Dimension(GuiStaticVars.getUnoWidth(),GuiStaticVars.getUnoHeight()));
this.html.setEditable(false);
//Only body tag will be displayed
this.html.setDoubleBuffered(true);
this.html.addHyperlinkListener(this);
//Scrollbar
JScrollPane scroll = new JScrollPane();
scroll.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scroll.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scroll.setPreferredSize(new Dimension(GuiStaticVars.getUnoHeight(),24));
scroll.setViewportView(html);
rulesPanel.add(html);
rulesPanel.add(scroll);
//Publish
this.rulesFrame.pack();
Center.centerOnScreen(rulesFrame);
this.rulesFrame.setVisible(true);
}