本文整理匯總了Java中javax.swing.JDesktopPane類的典型用法代碼示例。如果您正苦於以下問題:Java JDesktopPane類的具體用法?Java JDesktopPane怎麽用?Java JDesktopPane使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JDesktopPane類屬於javax.swing包,在下文中一共展示了JDesktopPane類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: highlightNext
import javax.swing.JDesktopPane; //導入依賴的package包/類
public static void highlightNext(String findText) {
int sel = jTabbedPane1.getSelectedIndex();
JTextPane textPane = (JTextPane) ((JScrollPane) ((JDesktopPane)jTabbedPane1.getComponentAt(sel)).getComponent(0)).getViewport().getComponent(0);
if (findText.isEmpty())
return;
String context = textPane.getText();
String wordToFind = findText;
pos = context.indexOf(wordToFind, currentPos);
if (pos == -1)
currentPos = 0;
pos = context.indexOf(wordToFind, currentPos);
currentPos = pos;
if (pos != -1) {
textPane.setSelectionStart(pos);
textPane.setSelectionEnd(pos + wordToFind.length());
textPane.requestFocusInWindow();
currentPos = (currentPos + 1);
} else {
currentPos = 0;
}
}
示例2: tabMaximize
import javax.swing.JDesktopPane; //導入依賴的package包/類
/**
* Tab maximize.
*/
private void tabMaximize() {
// --- Maximize the main window ---------------------------------------
// Application.getMainWindow().setExtendedState(JFrame.MAXIMIZED_BOTH);
// --- Open a new JInteraFrame with the current tab enlarged ----------
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JDesktopPane appDesktop = Application.getMainWindow().getJDesktopPane4Projects();
if (maxTab == null) {
appDesktop.add(getMaximizedTab());
Application.getMainWindow().addJToolbarComponent(getMaximizedTab().getJButtonRestore4MainToolBar());
}
DesktopManager dtm = Application.getMainWindow().getJDesktopPane4Projects().getDesktopManager();
if (dtm != null) {
dtm.activateFrame(getMaximizedTab());
dtm.maximizeFrame(getMaximizedTab());
}
}
});
}
示例3: InternalFrameDemo
import javax.swing.JDesktopPane; //導入依賴的package包/類
public InternalFrameDemo() {
super("InternalFrameDemo");
// Make the big window be indented 50 pixels from each edge
// of the screen.
int inset = 50;
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setBounds(inset, inset, screenSize.width - inset * 2, screenSize.height - inset * 2);
// Set up the GUI.
desktop = new JDesktopPane(); // a specialized layered pane
createFrame(); // create first "window"
setContentPane(desktop);
setJMenuBar(createMenuBar());
// Make dragging a little faster but perhaps uglier.
desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
}
示例4: isProbablyAContainer
import javax.swing.JDesktopPane; //導入依賴的package包/類
/**
* Return true if the given component is likely to be a container such the each
* component within the container should be be considered as a user input.
*
* @param c
* @return true if the component children should have this listener added.
*/
protected boolean isProbablyAContainer (Component c) {
boolean result = extListener != null ? extListener.isContainer(c) : false;
if (!result) {
boolean isSwing = isSwingClass(c);
if (isSwing) {
result = c instanceof JPanel || c instanceof JSplitPane || c instanceof
JToolBar || c instanceof JViewport || c instanceof JScrollPane ||
c instanceof JFrame || c instanceof JRootPane || c instanceof
Window || c instanceof Frame || c instanceof Dialog ||
c instanceof JTabbedPane || c instanceof JInternalFrame ||
c instanceof JDesktopPane || c instanceof JLayeredPane;
} else {
result = c instanceof Container;
}
}
return result;
}
示例5: jButton1ActionPerformed
import javax.swing.JDesktopPane; //導入依賴的package包/類
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String pattern1 = "[A-z\\s]*";
String fname = jTextField6.getText();
String box1 = jTextField1.getText();
String box2 = jTextField2.getText();
String box3 = jTextField3.getText();
String box4 = jTextField4.getText();
String box5 = jTextField5.getText();
Integer box7 = Integer.parseInt(jTextField7.getText());
Integer box8 = Integer.parseInt(jTextField8.getText());
if((fname.matches(pattern1))&&(box1.length()==4)&&(box2.length()==4)&&(box3.length()==4)&&(box4.length()==4)&&(box5.length()==3)&&(box7<12)&&(box8>17)) {
JOptionPane.showMessageDialog(rootPane, "payment detils wrong");
JDesktopPane desktopPane = getDesktopPane();
Customerlogin cl =new Customerlogin(cus.getPass_no());
desktopPane.add(cl);
cl.setVisible(true);
this.dispose();
}
// TODO add your handling code here:
}
示例6: jButton1ActionPerformed
import javax.swing.JDesktopPane; //導入依賴的package包/類
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
JDesktopPane desktopPane = getDesktopPane();
int class_ = Integer.parseInt(jComboBox2.getSelectedItem().toString());
LegClasses lc = new LegClasses(fl.getLeg_no(), class_);
if (!lc.isExist()) {
JOptionPane.showMessageDialog(rootPane, "Error: Selected Flight doesnt have that class type");
} else {
float amount = lc.getPrice();
Tickets tk = new Tickets();
tk.setLeg_no(fl.getLeg_no());
tk.setClass_(class_);
tk.setPass_no(cus.getPass_no());
tk.setSeat_no(Integer.parseInt(jComboBox1.getSelectedItem().toString()));
if (!tk.save()) {
JOptionPane.showMessageDialog(rootPane, "Error: Could not reserve ticket");
} else {
Payment p = new Payment(cus.getPass_no(), amount);
desktopPane.add(p);
p.setVisible(true);
this.dispose();
}
}
}
示例7: jButton3ActionPerformed
import javax.swing.JDesktopPane; //導入依賴的package包/類
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
JDesktopPane desktopPane = getDesktopPane();
String user = jTextField3.getText();
String pass = new String(jPasswordField2.getPassword());
Admin a = new Admin();
if (a.adminLogin(user, pass)) {
Adminlogin al = new Adminlogin();
desktopPane.add(al);
al.setVisible(true);
this.dispose();
} else {
JOptionPane.showMessageDialog(rootPane, "Error: Username or password incorrect");
}
}
示例8: findNext
import javax.swing.JDesktopPane; //導入依賴的package包/類
public static void findNext() {
int sel = jTabbedPane1.getSelectedIndex();
JTextPane textPane = (JTextPane) ((JScrollPane) ((JDesktopPane)jTabbedPane1.getComponentAt(sel)).getComponent(0)).getViewport().getComponent(0);
if (findword.getText().isEmpty())
return;
String context = textPane.getText();
String wordToFind = findword.getText();
pos = context.indexOf(wordToFind, currentPos);
if (pos == -1)
currentPos = 0;
pos = context.indexOf(wordToFind, currentPos);
currentPos = pos;
if (pos != -1) {
textPane.setSelectionStart(pos);
textPane.setSelectionEnd(pos + wordToFind.length());
textPane.requestFocusInWindow();
currentPos = (currentPos + 1);
} else {
currentPos = 0;
notfound.setVisible(true);
}
}
示例9: Test6505027
import javax.swing.JDesktopPane; //導入依賴的package包/類
public Test6505027(JFrame main) {
Container container = main;
if (INTERNAL) {
JInternalFrame frame = new JInternalFrame();
frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
frame.setVisible(true);
JDesktopPane desktop = new JDesktopPane();
desktop.add(frame, new Integer(1));
container.add(desktop);
container = frame;
}
if (TERMINATE) {
this.table.putClientProperty(KEY, Boolean.TRUE);
}
TableColumn column = this.table.getColumn(COLUMNS[1]);
column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));
container.add(BorderLayout.NORTH, new JTextField());
container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
示例10: prepareControls
import javax.swing.JDesktopPane; //導入依賴的package包/類
@Override
protected void prepareControls() {
JDesktopPane desktopPane = new JDesktopPane();
JInternalFrame bottomFrame = new JInternalFrame("bottom frame", false, false, false, false);
bottomFrame.setSize(220, 220);
super.propagateAWTControls(bottomFrame);
desktopPane.add(bottomFrame);
bottomFrame.setVisible(true);
JInternalFrame topFrame = new JInternalFrame("top frame", false, false, false, false);
topFrame.setSize(200, 200);
topFrame.add(new JButton("LW Button") {
{
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
lwClicked = true;
}
});
}
});
desktopPane.add(topFrame);
topFrame.setVisible(true);
JFrame frame = new JFrame("Test Window");
frame.setSize(300, 300);
frame.setContentPane(desktopPane);
frame.setVisible(true);
locTopFrame = topFrame.getLocationOnScreen();
locTarget = new Point(locTopFrame.x + bottomFrame.getWidth() / 2, locTopFrame.y + bottomFrame.getHeight()/2);
}
示例11: main
import javax.swing.JDesktopPane; //導入依賴的package包/類
public static void main(String[] args) throws Exception {
defaultBackgroudColor = (Color) Toolkit.getDefaultToolkit()
.getDesktopProperty("win.mdi.backgroundColor");
String[] lookAndFeel = new String[]{
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel",
"com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel"};
for (String laf : lookAndFeel) {
UIManager.setLookAndFeel(laf);
SwingUtilities.invokeAndWait(() -> {
JDesktopPane desktopPane = new JDesktopPane();
Color background = desktopPane.getBackground();
if (!background.equals(defaultBackgroudColor)) {
throw new RuntimeException("Invalid JDesktopPane "
+ "Background Color for WLAF");
}
});
}
}
示例12: createUI
import javax.swing.JDesktopPane; //導入依賴的package包/類
private static void createUI() {
frame = new JFrame();
frame.setUndecorated(true);
frame.setSize(300, 300);
frame.setLocationRelativeTo(null);
final JDesktopPane pane = new JDesktopPane();
final JPanel panel = new JPanel() {
@Override
protected void paintComponent(Graphics g) {
g.setColor(color);
g.fillRect(0, 0, getWidth(), getHeight());
}
};
jif = new JInternalFrame();
jif.add(panel);
jif.setVisible(true);
jif.setSize(300, 300);
pane.add(jif);
frame.add(pane);
frame.setVisible(true);
}
示例13: createAndShowGUI
import javax.swing.JDesktopPane; //導入依賴的package包/類
private static void createAndShowGUI() {
frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
desktopPane = new JDesktopPane();
desktopPane.setBackground(BACKGROUND_COLOR);
frame.add(desktopPane, BorderLayout.CENTER);
frame.setSize(FRAME_SIZE, FRAME_SIZE);
frame.setVisible(true);
internalFrame = new JInternalFrame("Test");
internalFrame.setSize(FRAME_SIZE / 2, FRAME_SIZE / 2);
desktopPane.add(internalFrame);
internalFrame.setVisible(true);
internalFrame.setResizable(true);
frame.setVisible(true);
}
示例14: createUI
import javax.swing.JDesktopPane; //導入依賴的package包/類
private static void createUI(String lookAndFeelString) {
internalFrame = new JInternalFrame("Internal", true, true, true, true);
internalFrame.setDefaultCloseOperation(
WindowConstants.DO_NOTHING_ON_CLOSE);
internalFrame.setSize(200, 200);
JDesktopPane desktopPane = new JDesktopPane();
desktopPane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
desktopPane.add(internalFrame);
mainFrame = new JFrame(lookAndFeelString);
mainFrame.setSize(640, 480);
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setContentPane(desktopPane);
mainFrame.setVisible(true);
internalFrame.setVisible(true);
}
示例15: ViewingPanel
import javax.swing.JDesktopPane; //導入依賴的package包/類
/**
* Create a panel in which a JDesktopPane is used to
* to display screens for viewing a Player.
*
* @param title
* Title displayed in border of JDesktopPane
*/
public ViewingPanel(String title) {
TitledBorder tb;
setLayout(new BorderLayout());
desktop = new JDesktopPane();
desktop.setLayout(new TileLayout());
desktop.setBorder(tb = new TitledBorder(
new CompoundBorder(
new EtchedBorder(),
new EmptyBorder(4, 4, 4, 4)),
title));
tb.setTitleColor(Color.black);
desktop.setOpaque(false);
desktop.setBackground(UIManager.getColor("control"));
add(desktop, BorderLayout.CENTER);
hash = new Hashtable();
}