Setting icon position
I'm having a problem with the code below:
It will compile in the editor but I get an error when it's run - Finder got an error: Can't set position of item bla, bla....
If tried every possible combination that I can think of for the correct syntax, anything that I can get to compile produces the same error.
tell application "Finder"
set position of item "test.txt" of folder "Macintosh HD:Users:mattbratt:Mars:" to {270, 26}
end tell
Misread post, nevermind
Message was edited by: Frank Caggiano
Similar Messages
-
How to set icon in JavaHelp frame?
Hello everybody
I'm using JavaHelp 2.0 for the first time and I have been told that it is possible to set the icon within the JavaHelp frame. Furthermore it should be possible to set the position of the help window.
I used the following code within my Java class to start JavaHelp, as the help frame should appear, when the user clicks on "JavaHelp" within the "Help" menu:
JMenu helpMenu = new JMenu("Help");
try {
URL hsURL = new File("javahelp/DbManager.hs").toURL();
HelpSet hs = new HelpSet(null, hsURL);
HelpBroker hb = hs.createHelpBroker();
menuItem = new JMenuItem("JavaHelp");
menuItem.addActionListener(new CSH.DisplayHelpFromSource(hb));
helpMenu.add(menuItem);
} catch (Exception e) {
}My helpset is called "DbManager.hs" and here's the presentation section of it (of course the image "dbmanager.title.image" is defined within the map file):
<!-- presentation -->
<presentation default="true" displayviews="true" displayviewimages="false">
<name>MainWindow</name>
<size width="600" height="500" />
<location x="200" y="200" />
<title>Database Manager</title>
<image>dbmanager.title.image</image>
</presentation>When I start the JavaHelp it does not show the Icon and it does not set the size and location accordingly.
I'd be very glad for any hint on what I might be overlooking.
Thanks,
ChristianHi,
You need to specify the name of your presentation in the createHelpBroker call:
JMenu helpMenu = new JMenu("Help");
try {
URL hsURL = new File("javahelp/DbManager.hs").toURL();
HelpSet hs = new HelpSet(null, hsURL);
HelpBroker hb = hs.createHelpBroker("MainWindow");
menuItem = new JMenuItem("JavaHelp");Then it should work.
Brendan -
How to set the position in SAP Script
Hi Professionals,
Can anyone tell me that How can I set the position of an bitmap Image (after inserting) in SAP Script ?
by default position is in Left, I need to align it in center or somewhere else.
Anybody knows, kindly reply!
Thanks
DevinderHi,
But Can we assign a window under another window. Because I want to insert a bmp picture on particular position.
example:- there is a digital signature and wanted to insert upon a name.
So, there is a text (which is customer name) and digital signature (in bmp picture format) upon it.
Thanks
Devinder -
How to set icon on MenuItem, but not in JMenuItem?
saleemtol003 wrote:
You are right.It's not possible to set icon on menuItem.
I am talking about SystemTray in which I added PopupMenu with MenuItem.
but I need MenuItem with icon.Is there another way to solve this problem?Nope, just because you're adding a PopupMenu to a TrayIcon does not change the fact that MenuItems cannot have icons. -
I need to set the position of components on a page that contains a MenuBar,
I need to set the position of components on a page that contains a MenuBar, but MenuBar does not provide a getPreferred size method.
How can I get the MenuBar's size in AWT?
Thanks.A menubar is not a general component that is added to a frame like any another. It is the specific responsibility of the setMenuBar/setJMenuBar methods to deal with this.
-
Set file position within a for loop, error 1
Hi, I'm reading from a .sxm file consisting of a large chunk of text followed by binary data for 512x512 images with 4 bytes per pixel
I’ve managed to successfully identify the start of the binary and read the first image from the file and view it using "flatten pixmap.vi", so I’m doing something right, however when i try to read the next chunk of image data in the .sxm file using a for loop, set file position keeps churning out ERR (1).
im at a loss as to whats causing this
Solved!
Go to Solution.
Attachments:
binaryread3d trouble.vi 22 KB
back panel screenshot.png 27 KBI closed the file in the loop, doh! ... another morning well spent
-
Set audio position microseconds/Player
Hay,
I've made this nifty little class for playing audio:
import java.io.*;
import javax.sound.sampled.*;
public class Player implements LineListener
// Consts
public static final float maxVol = 6.0206f;
public static final float minVol = -80.0f;
// Vars
// The AudioInputStream to play
private AudioInputStream toPlay = null;
// If the playthread should pause
private volatile boolean paused = false;
// If the thingy is playing
private volatile boolean playing = false;
// The line
private volatile SourceDataLine line = null;
// The thread that will play the sound
private Thread playThread = null;
// Construtor
// Body
public void play(String toPlay)
try {
// If playing
if (playing && paused && (!line.isRunning())) {
setPaused(false);
// The return so don't play again
return;
play(new FileInputStream(toPlay));
} catch (Exception ex) {ex.printStackTrace();}
public void play(File toPlay) {
try {
// If playing
if (playing && paused && (!line.isRunning())) {
setPaused(false);
// The return so don't play again
return;
play(new FileInputStream(toPlay));
} catch (Exception ex) {ex.printStackTrace();}
public void play(InputStream toPlay) {
try {
// If playing
if (playing && paused && (!line.isRunning())) {
setPaused(false);
// The return so don't play again
return;
// Get AudioInputStream from given file.
this.toPlay = AudioSystem.getAudioInputStream(toPlay);
} catch (Exception ex) {ex.printStackTrace();}
// Make the play thread
playThread = new Thread(new PlayThread());
// Start it
playThread.start();
public void stop()
// Not playing
playing = false;
// If there is a line
if (line != null)
// Close the line
line.close();
line = null;
// Distroy the play thread
playThread = null;
public void update(LineEvent e)
// Stop
if (e.getType()==LineEvent.Type.STOP)
stop();
// Getters
public SourceDataLine getLine()
if (line != null)
return line;
return null;
public float getVolume()
FloatControl con = (FloatControl) line
.getControl(FloatControl.Type.MASTER_GAIN);
// Get value
return con.getValue();
public boolean getMute()
BooleanControl con = (BooleanControl) line
.getControl(BooleanControl.Type.MUTE);
// Get
return con.getValue();
// Setters
public void setPaused(boolean inPaused)
paused = inPaused;
// If not null
if (line != null)
// If paused
if (paused)
// Stop the line
line.stop();
} // Resume
else
// Start
line.start();
// Setters
public void setVolume(float vol)
// TODO: Maybe test to see if within min an max
FloatControl con = (FloatControl) line
.getControl(FloatControl.Type.MASTER_GAIN);
// Set value
con.setValue(vol);
public void setMute(boolean mute)
BooleanControl con = (BooleanControl) line
.getControl(BooleanControl.Type.MUTE);
// Set
con.setValue(mute);
private class PlayThread implements Runnable
public void run()
try {
System.out.println("toPlay is null " + (toPlay == null));
// If not playing
if (!playing)
// Now playing
playing = true;
play();
System.out.println("Finished");
} catch (Exception ex) {ex.printStackTrace();}
private void play()
try {
AudioInputStream din = null;
if (toPlay != null)
AudioFormat baseFormat = toPlay.getFormat();
AudioFormat decodedFormat = new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED, baseFormat
.getSampleRate(), 16, baseFormat
.getChannels(),
baseFormat.getChannels() * 2, baseFormat
.getSampleRate(), false);
// Get AudioInputStream that will be decoded by underlying
// VorbisSPI
din = AudioSystem
.getAudioInputStream(decodedFormat, toPlay);
// Play now !
rawplay(decodedFormat, din);
toPlay.close();
} catch (Exception e) {e.printStackTrace();}
private void rawplay(AudioFormat targetFormat, AudioInputStream din)
throws IOException, LineUnavailableException
byte[] data = new byte[4096];
line = getLine(targetFormat);
if (line != null)
// Start
line.start();
int nBytesRead = 0, nBytesWritten = 0;
while (nBytesRead != -1)
// While still paused
while (paused) {}
nBytesRead = din.read(data, 0, data.length);
if (nBytesRead != -1)
nBytesWritten = line.write(data, 0, nBytesRead);
// Stop
line.drain();
line.stop();
line.close();
din.close();
private SourceDataLine getLine(AudioFormat audioFormat)
throws LineUnavailableException
SourceDataLine res = null;
DataLine.Info info = new DataLine.Info(SourceDataLine.class,
audioFormat);
res = (SourceDataLine) AudioSystem.getLine(info);
res.open(audioFormat);
return res;
}I've got an app that uses JMF to play MP3's, but using JMF just to play MP3's is overkill, but I've found a SPI from javaZoom now, so that's okay.
Anyway, I want to set the position of the line in microseconds now, as well as get the duration.
Can anyone help with this?
By the way, if anyone can open .rar files (lots of complainants about that) then the, in much need of an update, app is here: http://acquiesce.awardspace.co.uk/Projects/Download/Music_Exploder.rar
I you do want to try it, you do need the JMF.
Why not pop into the forum as well:
http://acquiesce.informe.com/mucic-exploder-dc4.html
You know I need the comments.
Luke :Dokay, so u can do this in the Clip interface, but the Clip takes ages to open, at lest for mp3's.
I need it to open it right away
I understand a bit more now, the SourceDataLine plays each byte as it is writen which is why it plays it straight away, but the Clip loads it into memory, so therefore it knows how long, how many frames etc about the audio, but it means that it's not as fast as streaming.
I need the best of both worlds really, I've tried opening a Clip on another Thread as well as playing from a SourceDataLine, the idea was to have the Clip take over the playing once it has loaded, but the line doesn't play or read/write.
Is there someway to take advantage of both streaming an non-streaming in this way?
Or simply make the Clip.open_AudioImputStream) faster?
Thanks
Luke -
Setting Icon to turn on WiFi is greyed out, why?
Setting Icon to turn on WiFi is greyed out, why?
See
https://discussions.apple.com/message/21488384#21488384
If fault continues, get the iPhone changed. -
How can we set icon to a tree table
Hi ADF Experts,
The below is regarding skinning of af:tree table component.
How can we set icon to a tree table
Below is the af:tree component. When I run the application I see all the parent and child nodes as folder icon. My question is how can set a file icon to the elements present inside a parent node.
<af:treeTable value="#{pageFlowScope.MerchandizeTreeModel.productTreeModel}"
id="tt1" var="row"
rowSelection="multiple"
horizontalGridVisible="false"
verticalGridVisible="false">
<f:facet name="nodeStamp">
<af:column sortable="false" headerText=""
rowHeader="true" id="c11" width="200">
<af:panelGroupLayout id="pgl0">
<af:image source="/images/folder.png" shortDesc="foldericon"
id="i1"/>
<af:outputText value="#{row.groceryItems}" id="ot11"/>
</af:panelGroupLayout>
</af:column>
</f:facet>
</af:treeTable>
Thanks in advance,
AnimeshHi Experts,
I am having a tree table component in adf. I have set a folder image for the parent node. How can we set a document image for contents inside a parent node.
Thanks,
Biswa -
Desktop icons position not kept
Hi. I'm using 10.6.2 and sometimes (not all) when I start my machine, the desktop icons (which I have arranged by snap to grid) are not where they used to be the last time I was with the cmputer on but they all show up aligned on the right of the screen, next to the hard drive icons in columns. I did not yet find a patteen like "this only happens if I have the computer turned of more than X x or y hours". Sometimes I leave for a couple of days and the icons are good when I come back. Sometimes just a few hours with the computer turned off and the icons position is not kept. Other time is the other way around.
Any ideas? Someone with the same issue?
Thanks.I had this problem, too, and brought it up with a "Genius" this morning. His solution -- which seems to have worked -- was first to show hidden files (using a utility or Terminal, as described elsewhere) and then delete the .DS_Store file which now appears on the desktop. The file rebuilt itself, and the icons now stay where I put them after a restart or relaunch of the Finder. You should rehide the hidden files once you've done this.
I had previously tried resetting the PRAM and deleting a couple of plist files from the Preferences Library, which other people had recommended, but those solutions didn't work. This did. Thanks, Geniuses in Emeryville.
Rick -
Hi all,
Can we able to set icon in the title bar of the JDialog?
Waiting for replies...........http://www.google.com/search?hl=en&q=Java+%2B+JDialog+%2B+setIcon
Follow the bouncing link.
PS. -
Setting icon for MII version 12.1.x custom action
Hi,
i tryed to set icon image for custom action for MII version 12.1.x but i did not achieve.
How can it be done?
Thanks.Hello,
I have done it in 11.5. This is how I did it in 11.5. (I am hoping that it has not changed in 12.1)
//funciton for specifying icon
public String GetIconPath() {
return "com/path/to/icons/imagename.png";
Store your image file in the following way
com/path/to/icons and name that as imagename.png
There is also a blog on it
/people/rupesh.bajaj/blog/2007/12/04/beginners-guide-to-create-custom-action-block
I hope it helps.
Regards,
Musarrat
Edited by: Musarrat Husain on May 17, 2011 12:18 PM -
Pls help me for the following query:
how to set cursor position at the beginning of text field(JTextField) after setting text inside it.RTFM
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/JTextComponent.html#setCaretPosition(int) -
How do you set the position of JScrollBars?
Can anyone tell me how to set the positions of the JScrollBars in a JScrollPane so that it will show the area I want?
please,
TommySorry i should of add the area I am talking about is a JPanel.
-
Hi,
I am using LabVIEW 2009 SP1 on Win XP OS system. I am reading and writing data to a text file whose size does not exceed 50 MB. whenever i try to set file position to a value of say 128 bytes from the start of file, the function does not show an error. But when i try to read back the file position using get file position function, the value shows a very high number. I am not able to do a random access read of the file data. Please help.
Regards,
YashasviHi Yashasvi,
can you post the vi (or vi section) causing the problem?
Thanks,
Marco
Maybe you are looking for
-
Moving OS hard drives between Macs of different makes/models
Is it okay to move the operating system hard drive (E.g. the Boot drive) from one mac to another? What about from one model of mac (E.g. a Mac Mini) to a different model. (Mac Pro) In the PC world, this is an absolute no no due to drivers, registry i
-
Install boot camp partition on Mac mini
How to install boot camp on a Mac mini? It ask for a bootable DVD which I have inserted in my Mac book pro, but it does not recognize the DVD. How can I install boot camp on a mini?
-
Hello, Our Portal version is: J2EE Engine.............................7.00 PatchLevel 35355.450 Portal..................................7.00 KnowledgeManagementCollaboration........7.00 (NW04 SPS13) we have a problem with a custom webdynpro Appli
-
Sales order quantity gets confirmed Automatically
Dear All, I have make to order Scenario. i have done all setting required for MTO. however i create sales order my order quantity gets confirmed automatically. same time there is not stock available for material. plz suggest how to stop confirm qty.
-
Is there a way to hide the cursor or change the cursor to a hand?
Hi, I think the title is self explanatory. The reason I want to do it is because I'm developing a touchscreen interface and I reckon it would look better if I had a hand instead of a cursor or if I got rid of the cursor completely. Cheers, elmicko