<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.sampleforstack.MainActivity" >
<!--This is your main layout. Add your content here -->
<LinearLayout
android:id="@+id/lytMain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/accent_material_dark">
</LinearLayout>
<!--This is your menu layout. Add smile buttons here -->
<LinerLayout
android:id="@+id/lytMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone">
</LinerLayout>
</RelativeLayout>
答案 0 :(得分:0)
包含cp
的组件displayArea
永远不会添加到任何内容
public Ch5PA1() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
createIcon();
createLabel();
createTextArea();
createCombo();
createButton();
createPanels();
JComponent cp = (JComponent) getContentPane();
cp.setLayout(new BorderLayout(0, 40));
cp.setBorder(new EmptyBorder(20, 20, 20, 20));
cp.add(p1, BorderLayout.WEST);
cp.add(new JScrollPane(displayArea), BorderLayout.CENTER);
cp.add(p2, BorderLayout.CENTER);
// Not added to anything?
}
答案 1 :(得分:0)