本文整理汇总了Java中javax.swing.JTextPane.setBounds方法的典型用法代码示例。如果您正苦于以下问题:Java JTextPane.setBounds方法的具体用法?Java JTextPane.setBounds怎么用?Java JTextPane.setBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextPane
的用法示例。
在下文中一共展示了JTextPane.setBounds方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: About
import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
* Create the frame.
*/
public About() {
ImageIcon img = new ImageIcon("icon.PNG");
this.setIconImage(img.getImage());
this.setTitle("About");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 705, 335);
contentPane = new JPanel();
contentPane.setBackground(SystemColor.activeCaptionBorder);
contentPane.setToolTipText("erh");
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JTextPane txtpnByIkerGarca = new JTextPane();
txtpnByIkerGarca.setBackground(SystemColor.menu);
txtpnByIkerGarca.setEditable(false);
txtpnByIkerGarca.setText("By: Iker Garc\u00EDa Ferrero\r\nDate: 03/01/2017\r\n\r\n--Contact--\r\nMail: [email protected] \r\n\r\nThe source code can be found here:\r\nhttps://github.com/ikergarcia1996/Simple-AI_Ikerg-app_INTELLIGENT_POINTS\r\n\r\nA demostration and explanation can be found here (Spanish):\r\nhttps://www.youtube.com/hardware360grados\r\n\r\nThis program uses Processing 3.2.3\r\n\r\nCopyright 2017 Iker Garc\u00EDa \"Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)\" ");
txtpnByIkerGarca.setToolTipText("");
txtpnByIkerGarca.setBounds(12, 13, 664, 262);
contentPane.add(txtpnByIkerGarca);
}
示例2: initialize
import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
* Initializes the GUI.
*/
private void initialize(){
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
// error window
windowError = new JFrame();
windowError.setBounds(100, 100, 300, 145);
windowError.setLocation(dim.width/2-windowError.getSize().width/2, dim.height/2-windowError.getSize().height/2);
windowError.setResizable(false);
windowError.setTitle("Ladder Tracker v" + version);
windowError.setIconImage(new ImageIcon(getClass().getResource("icon.png")).getImage());
windowError.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
windowError.getContentPane().setLayout(null);
// button retry
buttonRetry = new JButton("Retry");
buttonRetry.setBounds(10, 80, 274, 23);
buttonRetry.addActionListener(buttonRetryListener);
windowError.getContentPane().add(buttonRetry);
// error text
JTextPane textError = new JTextPane();
textError.setText(errorMessage);
textError.setEditable(false);
textError.setBackground(SystemColor.menu);
textError.setBounds(10, 21, 274, 39);
windowError.getContentPane().add(textError);
}
示例3: SignUpPanel
import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
* Create the panel.
*/
public SignUpPanel() {
setLayout(null);
JLabel lblNewLabel = new JLabel("Hearthstone");
lblNewLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 35));
lblNewLabel.setBounds(150, 35, 211, 61);
add(lblNewLabel);
JPanel panel = new JPanel();
panel.setBorder(new LineBorder(new Color(0, 0, 0)));
panel.setBounds(434, 20, 245, 260);
add(panel);
panel.setLayout(null);
JLabel lblUpdateNotes = new JLabel("Update Notes:");
lblUpdateNotes.setBounds(6, 6, 89, 16);
panel.add(lblUpdateNotes);
JTextPane txtpn_UpdateNotes = new JTextPane();
txtpn_UpdateNotes.setEditable(false);
txtpn_UpdateNotes.setBackground(this.getBackground());
txtpn_UpdateNotes.setText("* Added Support for Multiplayer\n\n\n* Support for login\n\n\n* Server can hold multiple games at once");
txtpn_UpdateNotes.setBounds(16, 34, 211, 207);
panel.add(txtpn_UpdateNotes);
JLabel label = new JLabel("Username:");
label.setBounds(58, 103, 70, 16);
add(label);
txt_Username = new JTextField();
txt_Username.setColumns(20);
txt_Username.setBounds(134, 97, 254, 28);
add(txt_Username);
JLabel label_1 = new JLabel("Password:");
label_1.setBounds(65, 151, 63, 16);
add(label_1);
psf_Password = new JPasswordField();
psf_Password.setColumns(20);
psf_Password.setBounds(134, 145, 254, 28);
add(psf_Password);
pwf_Retype = new JPasswordField();
pwf_Retype.setColumns(20);
pwf_Retype.setBounds(134, 191, 254, 28);
add(pwf_Retype);
JLabel lblRetypePassword = new JLabel("Retype Password:");
lblRetypePassword.setBounds(19, 197, 109, 16);
add(lblRetypePassword);
btn_Login = new JButton("Login");
btn_Login.setBounds(134, 240, 117, 29);
add(btn_Login);
btn_SignUp = new JButton("Sign Up");
btn_SignUp.setBounds(271, 240, 117, 29);
add(btn_SignUp);
}
示例4: LoginPanel
import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
* Create the panel.
*/
public LoginPanel() {
setLayout(null);
jpf_Password = new JPasswordField();
jpf_Password.setBounds(123, 188, 254, 28);
jpf_Password.setColumns(20);
add(jpf_Password);
btn_Submit = new JButton("Login");
btn_Submit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
btn_Submit.setBounds(123, 228, 117, 29);
add(btn_Submit);
JLabel lblPassword = new JLabel("Password:");
lblPassword.setBounds(54, 194, 63, 16);
add(lblPassword);
JLabel lblUsername = new JLabel("Username:");
lblUsername.setBounds(47, 127, 70, 16);
add(lblUsername);
jtf_Username = new JTextField();
jtf_Username.setBounds(123, 121, 254, 28);
add(jtf_Username);
jtf_Username.setColumns(20);
JPanel panel = new JPanel();
panel.setBorder(new LineBorder(new Color(0, 0, 0)));
panel.setBounds(434, 20, 245, 260);
add(panel);
panel.setLayout(null);
JLabel lblUpdateNotes = new JLabel("Update Notes:");
lblUpdateNotes.setBounds(6, 6, 89, 16);
panel.add(lblUpdateNotes);
JTextPane txtpn_UpdateNotes = new JTextPane();
txtpn_UpdateNotes.setEditable(false);
txtpn_UpdateNotes.setBackground(this.getBackground());
txtpn_UpdateNotes.setText("* Added Support for Multiplayer\n\n\n* Support for login\n\n\n* Server can hold multiple games at once");
txtpn_UpdateNotes.setBounds(16, 34, 211, 207);
panel.add(txtpn_UpdateNotes);
JLabel lblNewLabel = new JLabel("Hearthstone");
lblNewLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 35));
lblNewLabel.setBounds(150, 35, 211, 61);
add(lblNewLabel);
btn_SignUp = new JButton("Sign Up");
btn_SignUp.setBounds(260, 228, 117, 29);
add(btn_SignUp);
}
示例5: AcercaDe
import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
* Create the frame.
*/
public AcercaDe(JFrame principal) {
setIconImage(Toolkit.getDefaultToolkit().getImage(AcercaDe.class.getResource("/biblioteca/images/book.png")));
this.principal=principal;
principal.setEnabled(false);
setTitle("Acerca de Biblioteca 2017");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 332, 330);
setLocationRelativeTo(null);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JTextPane txtpnHola = new JTextPane();
txtpnHola.setForeground(Color.WHITE);
txtpnHola.setEditable(false);
txtpnHola.setBackground(Color.BLACK);
txtpnHola.setText("Biblioteca 2017 \u00A9 Juan Delgado Salmer\u00F3n");
txtpnHola.setBounds(10, 11, 311, 20);
contentPane.add(txtpnHola);
JTextPane txtpnVersinBuild = new JTextPane();
txtpnVersinBuild.setForeground(Color.WHITE);
txtpnVersinBuild.setEditable(false);
txtpnVersinBuild.setText("Versi\u00F3n 1.1.0\r\nBuild 20170516-5000");
txtpnVersinBuild.setBackground(Color.BLACK);
txtpnVersinBuild.setBounds(10, 42, 311, 34);
contentPane.add(txtpnVersinBuild);
JTextPane txtpnCopyrightBiblioteca = new JTextPane();
txtpnCopyrightBiblioteca.setForeground(Color.WHITE);
txtpnCopyrightBiblioteca.setEditable(false);
txtpnCopyrightBiblioteca.setText("Copyright 2017 Biblioteca 2017 creado por Juan Delgado Salmer\u00F3n. Todos los derechos reservados por JunDev.\r\nEsta aplicaci\u00F3n tiene open-source los primeros 24 d\u00EDas de su distribuci\u00F3n, despu\u00E9s de dicha fecha se cobrar\u00E1n 200\u20AC por ella.");
txtpnCopyrightBiblioteca.setBackground(Color.BLACK);
txtpnCopyrightBiblioteca.setBounds(10, 98, 311, 109);
contentPane.add(txtpnCopyrightBiblioteca);
JLabel lblImage = new JLabel("");
lblImage.setIcon(new ImageIcon(AcercaDe.class.getResource("/biblioteca/images/jundev.png")));
lblImage.setBounds(10, 214, 311, 79);
contentPane.add(lblImage);
JPanel panel = new JPanel();
panel.setBackground(Color.BLACK);
panel.setBounds(0, 0, 331, 304);
contentPane.add(panel);
setVisible(true);
addWindowListener(this);
setResizable(false);
}
示例6: GUI
import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
* Constructor que arma el GUI.
*/
public GUI(){
contenedor=getContentPane();
contenedor.setLayout(null);
/*Creamos el objeto*/
fileChooser=new JFileChooser();
/*Propiedades del Label, lo instanciamos, posicionamos y
* activamos los eventos*/
labelTitulo= new JLabel();
labelTitulo.setText("l Tribunal Supremo Electorial");
labelTitulo.setBounds(110, 20, 180, 23);
areaDeTexto = new JTextArea();
areaDeTexto.setEditable(false);
//para que el texto se ajuste al area
areaDeTexto.setLineWrap(true);
//permite que no queden palabras incompletas al hacer el salto de linea
areaDeTexto.setWrapStyleWord(true);
scrollPaneArea = new JScrollPane();
scrollPaneArea.setBounds(20, 50, 350, 270);
scrollPaneArea.setViewportView(areaDeTexto);
/*Propiedades del boton, lo instanciamos, posicionamos y
* activamos los eventos*/
botonAbrir= new JButton();
botonAbrir.setText("Boton 1");
botonAbrir.setBounds(474, 281, 91, 23);
botonAbrir.addActionListener(this);
/*Agregamos los componentes al Contenedor*/
contenedor.add(labelTitulo);
contenedor.add(scrollPaneArea);
contenedor.add(botonAbrir);
btnNewButton = new JButton("Boton 2");
btnNewButton.setBounds(620, 281, 89, 23);
getContentPane().add(btnNewButton);
btnNewButton.addActionListener(this);
JTextPane txtpnInstruccionesnBoton = new JTextPane();
txtpnInstruccionesnBoton.setEditable(false);
txtpnInstruccionesnBoton.setFont(new Font("Dialog", Font.PLAIN, 14));
txtpnInstruccionesnBoton.setBackground(SystemColor.control);
txtpnInstruccionesnBoton.setText("Instrucciones: \r\nCargar: Cargar datos guategrafo.txt\r\nBoton 1: Preguntar el nombre de la ciudad origen y ciudad destino.\r\nBoton 2: Modificar grafo");
txtpnInstruccionesnBoton.setBounds(440, 50, 269, 101);
getContentPane().add(txtpnInstruccionesnBoton);
txtNoHayArchivo = new JTextField();
txtNoHayArchivo.setEditable(false);
txtNoHayArchivo.setForeground(Color.RED);
txtNoHayArchivo.setFont(new Font("Dialog", Font.BOLD | Font.ITALIC, 14));
txtNoHayArchivo.setText("No hay archivo cargado.");
txtNoHayArchivo.setBackground(Color.DARK_GRAY);
txtNoHayArchivo.setBounds(509, 190, 204, 34);
getContentPane().add(txtNoHayArchivo);
txtNoHayArchivo.setColumns(10);
btnCargar = new JButton("Cargar");
btnCargar.setBounds(410, 197, 89, 23);
getContentPane().add(btnCargar);
btnCargar.addActionListener(this);
//Asigna un titulo a la barra de titulo
setTitle("Proyecto");
//tama�o de la ventana
setSize(750,363);
//pone la ventana en el Centro de la pantalla
setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
示例7: GameUI
import javax.swing.JTextPane; //导入方法依赖的package包/类
/**
* Create the frame.
*/
public GameUI(GameRunnerMVC controller) {
this.controller = controller;
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 491, 426);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
textArea = new JTextArea();
textArea.setLineWrap(true);
textArea.setBounds(10, 25, 455, 196);
textArea.setText("");
contentPane.add(textArea);
textPane1 = new JTextPane();
textPane1.setBounds(10, 0, 149, 20);
textPane1.setText("Health: 50");
contentPane.add(textPane1);
textPane2 = new JTextPane();
textPane2.setBounds(169, 0, 134, 20);
textPane2.setText("Money: 50");
contentPane.add(textPane2);
textPane3 = new JTextPane();
textPane3.setBounds(313, 0, 134, 20);
textPane3.setText("Satisfaction: 50");
contentPane.add(textPane3);
button1 = new JButton("");
button1.setFont(new Font("Tahoma", Font.PLAIN, 11));
button1.setBounds(10, 230, 222, 40);
contentPane.add(button1);
button2 = new JButton("");
button2.setBounds(243, 230, 222, 40);
contentPane.add(button2);
button3 = new JButton("");
button3.setBounds(10, 281, 222, 40);
contentPane.add(button3);
button4 = new JButton("");
button4.setBounds(243, 281, 222, 40);
contentPane.add(button4);
button5 = new JButton("");
button5.setBounds(10, 332, 222, 40);
contentPane.add(button5);
button6 = new JButton("");
button6.setBounds(243, 332, 222, 40);
contentPane.add(button6);
}