本文整理汇总了Java中org.jivesoftware.Spark.isWindows方法的典型用法代码示例。如果您正苦于以下问题:Java Spark.isWindows方法的具体用法?Java Spark.isWindows怎么用?Java Spark.isWindows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.Spark
的用法示例。
在下文中一共展示了Spark.isWindows方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pickFile
import org.jivesoftware.Spark; //导入方法依赖的package包/类
private void pickFile(String title, JTextField field) {
if (fc == null) {
fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
if (Spark.isWindows()) {
fc.setFileSystemView(new WindowsFileSystemView());
}
}
fc.setDialogTitle(title);
int returnVal = fc.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
field.setText(file.getAbsolutePath());
}
}
示例2: blinkFrameIfNecessary
import org.jivesoftware.Spark; //导入方法依赖的package包/类
public void blinkFrameIfNecessary(final JFrame frame) {
final MainWindow mainWindow = SparkManager.getMainWindow();
if (mainWindow.isFocusOwner()) {
frame.setVisible(true);
}
else {
// Set to new tab.
if (Spark.isWindows()) {
frame.setState(Frame.ICONIFIED);
SparkManager.getNativeManager().flashWindow(frame);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
public void windowActivated(WindowEvent e) {
SparkManager.getNativeManager().stopFlashing(frame);
}
});
}
}
}
示例3: getChildElementXML
import org.jivesoftware.Spark; //导入方法依赖的package包/类
public String getChildElementXML() {
StringBuffer buf = new StringBuffer();
buf.append("<query xmlns=\"jabber:iq:spark\">");
// Add os specific information
if (Spark.isWindows()) {
buf.append("<os>windows</os>");
}
else if (Spark.isMac()) {
buf.append("<os>mac</os>");
}
else {
buf.append("<os>linux</os>");
}
buf.append("</query>");
return buf.toString();
}
示例4: getDownloadDir
import org.jivesoftware.Spark; //导入方法依赖的package包/类
/**
* Returns the Download Directory, doesnt return <code>null</code>
* @return {@link String}
*/
public String getDownloadDir() {
File downloadedDir = null;
if (Spark.isLinux() || Spark.isMac()) {
downloadedDir = new File(System.getProperty("user.home") + "/Downloads/");
Log.error(downloadedDir.getAbsolutePath());
} else if (Spark.isWindows()) {
String regpath = WinRegistryReader.getMyDocumentsFromWinRegistry();
if (regpath != null) {
downloadedDir = new File(regpath + "\\Downloads");
if (!downloadedDir.exists()) {
downloadedDir.mkdir();
}
}
else
{
// if for some Reason there is no "My Documents" Folder we should select the Desktop
downloadedDir = new File(System.getProperty("user.home") + "\\Desktop\\");
}
}
return props.getProperty("downloadDirectory", downloadedDir.getAbsolutePath());
}
示例5: pickFile
import org.jivesoftware.Spark; //导入方法依赖的package包/类
private void pickFile(String title, JTextField field) {
if (fc == null) {
fc = new JFileChooser();
if (Spark.isWindows()) {
fc.setFileSystemView(new WindowsFileSystemView());
}
}
fc.setDialogTitle(title);
int returnVal = fc.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
try {
field.setText(file.getCanonicalPath());
}
catch (IOException e) {
Log.error(e);
}
}
else {
}
}
示例6: CommandPanel
import org.jivesoftware.Spark; //导入方法依赖的package包/类
public CommandPanel(boolean doLayout) {
if (doLayout) {
if (Spark.isWindows()) {
setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
}
else {
setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
}
setOpaque(false);
// backgroundImage = Default.getImageIcon(Default.TOP_BOTTOM_BACKGROUND_IMAGE).getImage();
}
// setBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, new Color(197, 213, 230)));
}
示例7: getFileChooser
import org.jivesoftware.Spark; //导入方法依赖的package包/类
/**
* Returns a {@link JFileChooser} starting at the DownloadDirectory
*
* @return the filechooser
*/
public static JFileChooser getFileChooser() {
if (chooser == null) {
_localPreferences = SettingsManager.getLocalPreferences();
downloadedDir = new File(_localPreferences.getDownloadDir());
chooser = new JFileChooser(downloadedDir);
if (Spark.isWindows()) {
chooser.setFileSystemView(new WindowsFileSystemView());
}
}
return chooser;
}
示例8: initialize
import org.jivesoftware.Spark; //导入方法依赖的package包/类
@Override
public void initialize() {
Timer timer = new Timer();
// Check all 5 secounds
timer.schedule(this, (1000 * 10), (1000 * CHECKTIME));
if (Spark.isWindows()) {
keyHook = new KeyHook();
keyHook.initKeyHook();
} else {
addGlobalListener();
}
}
示例9: isLocalBuildAvailable
import org.jivesoftware.Spark; //导入方法依赖的package包/类
/**
* Checks to see if a new version of Spark has already been downloaded by not installed.
*
* @return true if a newer version exists.
*/
private boolean isLocalBuildAvailable() {
// Check the bin directory for previous downloads. If there is a
// newer version of Spark, ask if they wish to install.
if (Spark.isWindows()) {
File binDirectory = Spark.getBinDirectory();
File[] files = binDirectory.listFiles();
if (files != null) {
int no = files.length;
for (int i = 0; i < no; i++) {
File file = files[i];
String fileName = file.getName();
if (fileName.endsWith(".exe")) {
int index = fileName.indexOf("_");
// Add version number
String versionNumber = fileName.substring(index + 1);
int indexOfPeriod = versionNumber.indexOf(".");
versionNumber = versionNumber.substring(0, indexOfPeriod);
versionNumber = versionNumber.replaceAll("_online", "");
versionNumber = versionNumber.replaceAll("_", ".");
boolean isGreater = versionNumber.compareTo(JiveInfo.getVersion()) >= 1;
if (isGreater) {
// Prompt
promptForInstallation(file, Res.getString("title.new.client.available"), Res.getString("message.restart.spark.to.install"));
return true;
}
else {
file.delete();
}
}
}
}
}
return false;
}
示例10: blink
import org.jivesoftware.Spark; //导入方法依赖的package包/类
public void blink() {
final MainWindow mainWindow = SparkManager.getMainWindow();
if (mainWindow.isFocused()) {
return;
}
else {
// Set to new tab.
if (Spark.isWindows()) {
mainWindow.addWindowListener(new WindowAdapter() {
public void windowActivated(WindowEvent e) {
SparkManager.getNativeManager().stopFlashing(mainWindow);
}
});
if (!mainWindow.isFocused() && mainWindow.isVisible()) {
SparkManager.getNativeManager().flashWindow(mainWindow);
}
else if (!mainWindow.isVisible()) {
mainWindow.setState(Frame.ICONIFIED);
mainWindow.setVisible(true);
SparkManager.getNativeManager().flashWindow(mainWindow);
}
}
}
}
示例11: addEmoticonPack
import org.jivesoftware.Spark; //导入方法依赖的package包/类
/**
* Adds a new Emoticon pack to Spark.
*/
private void addEmoticonPack() {
if (fc == null) {
fc = new JFileChooser();
if (Spark.isWindows()) {
fc.setFileSystemView(new WindowsFileSystemView());
}
}
fc.setDialogTitle("Add Emoticon Pack");
fc.addChoosableFileFilter(new ZipFilter());
int returnVal = fc.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File pack = fc.getSelectedFile();
try {
EmoticonManager emoticonManager = EmoticonManager.getInstance();
String name = emoticonManager.installPack(pack);
if (name == null) {
JOptionPane.showMessageDialog(this, "Not a valid emoticon pack.", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
// If the name does not exists, add it to the message box.
for (int i = 0; i < emoticonBox.getItemCount(); i++) {
String n = (String)emoticonBox.getItemAt(i);
if (name.equals(n)) {
return;
}
}
emoticonBox.addItem(name);
// Set Selected
emoticonBox.setSelectedItem(name);
}
catch (Exception e) {
Log.error(e);
}
}
}
示例12: uninstall
import org.jivesoftware.Spark; //导入方法依赖的package包/类
@Override
public void uninstall() {
if (Spark.isWindows()) {
keyHook.quitKeyHook();
}
}
示例13: run
import org.jivesoftware.Spark; //导入方法依赖的package包/类
@Override
public void run() {
if (pref.isIdleOn()) {
PointerInfo info = MouseInfo.getPointerInfo();
// DecimalFormat format = new DecimalFormat("0.00");
// System.out.println(format.format(info.getLocation().getY()).toString()
// + "-" + 7.24288464E8 + "-" + (info.getLocation().getY() ==
// 7.24288464E8));
// System.out.println(format.format(info.getLocation().getX()).toString()
// + "-" + 7.24288464E8 + "-" + (info.getLocation().getX() ==
// 7.24288464E8));
int automaticIdleTime = (pref.getIdleTime() * 60) / CHECKTIME;
// Windows Desktop Lock
if (Spark.isWindows()) {
if (info != null) {
if (info.getLocation().getX() > 50000000
|| info.getLocation().getY() > 50000000) {
if (!hasChanged) {
Log.debug("Desktop Locked .. ");
hasChanged = true;
setIdle();
y = info.getLocation().getY();
x = info.getLocation().getX();
}
}
} else {
if (!hasChanged) {
Log.debug("Desktop Locked .. ");
hasChanged = true;
setIdle();
y = -1;
x = -1;
}
}
}
// Default Idle
if (info != null) {
if (x == info.getLocation().getX()
&& y == info.getLocation().getY()) {
if (counter > automaticIdleTime) {
if (!hasChanged) {
setIdle();
}
hasChanged = true;
}
counter++;
} else {
if (hasChanged) {
setOnline();
hasChanged = false;
}
counter = 0;
}
y = info.getLocation().getY();
x = info.getLocation().getX();
}
}
}
示例14: resLabel
import org.jivesoftware.Spark; //导入方法依赖的package包/类
/**
* Sets the resources on a {@link JLabel}. It sets the text, mnemonic,
* and labelFor property.
*
* @param label The Label on which to set the properties
* @param labelFor the {@link Component} to set with the
* <code>labelFor</code> property on the <code>label</code>.
* @param labelText The text label to set on the <code>label</code>
* @see JLabel#setText(String)
* @see JLabel#setLabelFor(Component)
* @see JLabel#setDisplayedMnemonic(int)
*/
public static void resLabel(JLabel label, Component labelFor, String labelText) {
label.setText(stripMnemonic(labelText));
if (Spark.isWindows()) {
label.setDisplayedMnemonic(getMnemonicKeyCode(labelText));
}
label.setLabelFor(labelFor);
}
示例15: resButton
import org.jivesoftware.Spark; //导入方法依赖的package包/类
/**
* Sets the resources on a subclass of {@link AbstractButton}. The common
* classes are {@link javax.swing.JRadioButton}, {@link javax.swing.JButton},
* and {@link javax.swing.JCheckBox}
* <p/>
* This method sets the text and mnemonic.
*
* @param button The button on which to set the text and mnemonoic
* @param labelText the text which contains the displayed text and mnemonic
* @see AbstractButton#setText(String)
* @see AbstractButton#setMnemonic(int)
*/
public static void resButton(AbstractButton button, String labelText) {
button.setText(stripMnemonic(labelText));
if (Spark.isWindows()) {
button.setMnemonic(getMnemonicKeyCode(labelText));
}
}