java swingで質問です。仕切線(ディバイダ)の現在の値を取得したいのですが、シンボル:変数 splitpane,40,58,シンボルを見つけられませんのエラーで困っているのですが、調べても、原因が分かりません。大変お手数ですが、どなたかご存知の方教えて頂けないでしょうか?コードがおそらく、無茶苦茶です。すみまん。コード↓import javax.swing.*;import java.awt.Dimension;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.BorderLayout;import java.awt.event.*;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JSplitPane;import javax.swing.border.BevelBorder;/** * @author */public class JSplitPane07_5 extends JFrame implements ActionListener { JSplitPane splitPane; JLabel posLabel; /** * @param args */ public static void main(String[] args) { JSplitPane07_5 frame = new JSplitPane07_5(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle(\u0026quot;JSplitPane サンプル07\u0026quot;); frame.setBounds(100, 200, 400, 300); frame.setVisible(true); } JSplitPane07_5() { splitpane = new JSplitPane(); JPanel leftPanel = new JPanel(); JButton leftButton = new JButton(\u0026quot;Left\u0026quot;); leftPanel.add(leftButton); JButton button = new JButton(\u0026quot;get\u0026quot;); button.addActionListener(this); posLabel = new JLabel(\u0026quot;pos:\u0026quot;); JPanel labelPanel = new JPanel(); labelPanel.add(posLabel); labelPanel.add(button); } public void actionPerformed(ActionEvent e){ int pos = splitpane.getDividerLocation(); posLabel.setText(\u0026quot;pos:\u0026quot; + pos); }}

Java

1件の回答

回答を書く

1198684

2026-01-03 14:20

+ フォロー

\u0026gt; 原因が分かりません

使用している変数の名前が違うからです。



× splitpane

○ splitPane

うったえる有益だ(0シェアするブックマークする

関連質問

Copyright © 2026 AQ188.com All Rights Reserved.

博識 著作権所有