Ich habe gerade mit GWT begonnen. Ich machte das Tutorial gegeben here. Aber als ich ein neues Projekt erstellt und zwei Schaltflächen in einem horizontalen Panel und dann im RootPanel hinzugefügt habe, wurde mir nur der Header angezeigt, den ich in der HTML-Datei erstellt habe. Kannst du mir sagen, was der Grund sein könnte? Hier ist die Java-Klasse, die HTML und XML: Java-Klasse:Tasten in der neuen GWT App
package org.elsys.salvation.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
public class Salvation implements EntryPoint {
private Button newData = new Button("New");
private Button existingData = new Button("Existing");
private HorizontalPanel mainHorizontalPanel = new HorizontalPanel();
private Label lastUpdatedLabel = new Label();
public void onModuleLoad() {
mainHorizontalPanel.add(newData);
mainHorizontalPanel.add(existingData);
mainHorizontalPanel.add(lastUpdatedLabel);
RootPanel.get("Salvation").add(mainHorizontalPanel);
}
}
Die HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="Salvation.css">
<title>Diploma Defences Organiser</title>
<script type="text/javascript" language="javascript" src="stockwatcher/stockwatcher.nocache.js"></script>
</head>
<body>
<h1>Diploma Defences Organiser</h1>
<div id="Salvation"></div>
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
<noscript>
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
Your web browser must have JavaScript enabled
in order for this application to display correctly.
</div>
</noscript>
</body>
</html>
Und die XML:
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='Salvation'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<entry-point class='org.elsys.salvation.client.Salvation'/>
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
</module>
Wie haben Sie das Projekt gestartet? Verwenden Sie Eclipse als codierende Umgebung? – Stefan
ja, Eclipse :) – malkoto1