本文整理匯總了Java中javax.swing.JWindow.setOpacity方法的典型用法代碼示例。如果您正苦於以下問題:Java JWindow.setOpacity方法的具體用法?Java JWindow.setOpacity怎麽用?Java JWindow.setOpacity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JWindow
的用法示例。
在下文中一共展示了JWindow.setOpacity方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: AutoSuggestor
import javax.swing.JWindow; //導入方法依賴的package包/類
/**
* Istanzia il suggeritore su un componente testo
*
* @param textComp finestra di testo su cui istanziare il suggeritore
* @param mainWindow finestra principale
* @param words lista di parole
* @param popUpBackground colore dello sfondo
* @param textColor colore del testo
* @param suggestionFocusedColor colore del suggeritore
* @param opacity indice di opacità
*/
public AutoSuggestor(JTextComponent textComp, Window mainWindow, List<String> words, Color popUpBackground, Color textColor, Color suggestionFocusedColor, float opacity) {
this.textComp = textComp;
this.suggestionsTextColor = textColor;
this.container = mainWindow;
this.suggestionFocusedColor = suggestionFocusedColor;
this.textComp.getDocument().addDocumentListener(documentListener);
setDictionary(words);
typedWord = "";
currentIndexOfSpace = 0;
tW = 0;
tH = 0;
autoSuggestionPopUpWindow = new JWindow(mainWindow);
autoSuggestionPopUpWindow.setOpacity(opacity);
suggestionsPanel = new JPanel();
suggestionsPanel.setLayout(new GridLayout(0, 1));
suggestionsPanel.setBackground(popUpBackground);
suggestionsPanel.setBorder(new LineBorder(Color.black));
addKeyBindingToRequestFocusInPopUpWindow();
}
示例2: start
import javax.swing.JWindow; //導入方法依賴的package包/類
/** Start the bot. */
public void start() {
Toolkit tk = Toolkit.getDefaultToolkit();
int xSize = ((int) tk.getScreenSize().getWidth());
int ySize = ((int) tk.getScreenSize().getHeight());
window = new JWindow();
window.setSize(xSize, ySize);
window.setOpacity(0.0f);
window.setVisible(true);
window.setAlwaysOnTop(true);
window.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (clicks < _numberOfLocations) {
location[clicks] = getLocation();
window.setVisible(false);
sleep();
click();
sleep();
window.setVisible(true);
sleep();
clicks += 1;
}
if (clicks == _numberOfLocations) {
window.setVisible(false);
process();
}
}
});
}