How to Resize Applets Dynamically within Browser Frames Как динамически изменять размеры апплеты в браузер фреймы
The problem I was trying to solve was to resize applets when the browser changes size , Проблему я пытался решить заключалась в том, чтобы изменить размер апплеты, когда браузер, изменения размера,
so as to always fill the total displayed area of the browser. таким образом, чтобы заполнить всегда отображается общая площадь браузера.
Googling I found an article from javaworld - Поиск в Google я нашел статью из javaworld -- Resize applets within browser frames Resize апплеты в браузер фреймы .
I soon found out that the solution doesn’t work on either Internet Explorer 6 or Netscape 7.1. Я вскоре выяснил, что решение не работает ни Internet Explorer 6 или Netscape 7,1.
The key problem is that applet.setSize() method doesn’t actually do anything! Основная проблема заключается в том, что applet.setSize () метод фактически не делать ничего!
So I did a bit of digging around and found a simpler solution. Так что я немного рыть вокруг и нашел простое решение.
The code shown below creates an applet with the same size as the browser window. Код показан ниже создает апплет с одинакового размера, как окно браузера.
Whenever the browser changes size the applet is resized dynamically. Всякий раз, когда браузер изменения размера апплета размер динамически. This is Это
achieved through the resize() method defined in Javascript. достигнут за счет размера () метод определен в Javascript. This method is Этот метод
invoked onLoad and onResize. ссылаться onLoad и onResize. The code works for the recent versions of Код работает на последних версиях
Internet Explorer & Netscape browsers. Internet Explorer и Netscape браузерами.
The two lines: Две строчки:
document.myApplet.width = width; document.myApplet.width = ширина;
document.myApplet.height = height; document.myApplet.height = высота;
are enough to change the width and height of the applet. вполне достаточно для изменения ширины и высоты апплета.
Remember to name the applet and refer to it by name. Не забудьте назвать апплет и передать ему имя.
Footnote: Сноска: EU ЕС has proposed a simpler solution to the original problem which is to set the width and height to 100% in the applet tag. предлагает простое решение для первоначальной проблеме, которая заключается в том, чтобы установить ширину и высоту до 100% в апплете тега. And that works for the problem I proposed. И это работает на проблему я предложил. Thanks for the solution EU! Спасибо за решение ЕС!
There are a few additional value to the original proposed solution over the new solution which are: Есть некоторые дополнительные ценности для первоначального предложенное решение в течение нового решения, которые:
- Finer control over the size of the applet, so for example you can say that the width leaves 20 pixels on both sides, but the height doesn’t etc. Благороднее контролировать размер апплета, так например, Вы можете сказать, что ширина листьев 20 пикселей с обеих сторон, но высота не т.д.
- Ability to control the size of the applet from the applet itself. Возможность контролировать размеры апплет с самого апплета. This is a big plus as in one project I am working we have a need to re-size the applet from within the applet. Это большой плюс, как в рамках одного проекта я работаю мы должны пересмотреть размер апплета из апплета. Now we can do it by calling a Javascript method from the applet. Теперь мы можем сделать это, позвонив Javascript метод апплета.
Filed under Поданного в соответствии с How To Как , Java Software Программное обеспечение Java | |
| |
RSS 2.0 RSS 2,0 | |
Email this Article Отослать Статья
You may also like to read Вы можете также люблю читать |




January 24th, 2004 at 11:56 am 24 января 2004 года в 11:56 утра
What about use “100%” for applet width and height? Как насчет использования "100%" апплет для ширины и высоты?
August 29th, 2004 at 9:31 pm 29 августа 2004 года в 9:31 вечера
[...] x 0.9.1 resize() showDocument() Internet Explorer 6.0 resize() I had posted a [...] Х 0.9.1 размер () showDocument () Internet Explorer 6,0 размер () я был размещен solution for the applet resize problem решение для апплета размер проблемы in an earlier blog entry. ранее в блоге записи.
Comments (0) [...] Комментарии (0) [...]
March 11th, 2005 at 4:23 pm 11 марта 2005 года в 4:23 вечера
[...] an it has been allocated, then how to go about it? [...] Она была выделена, то каким образом сделать это? Last time when faced with this problem I solved it with a nifty piece of Javascript method. Последний раз, когда сталкиваются с этой проблемой я решить ее с nifty кусок Javascript метод. However I soon realized there were few issues with t [...] Однако я вскоре осознали насчитывалось несколько вопросов с т [...]
March 11th, 2005 at 4:36 pm 11 марта 2005 года в 4:36 вечера
[...] Fox 0.9.1 resize() showStatus() Internet Explorer 6.0 resize() I had posted a solution for the applet resize problem in an earlier blog entry. [...] Фокс 0.9.1 размер () showStatus () Internet Explorer 6,0 размер () я был размещен решение для апплета размер проблема в блоге ранее запись. This entry was [...] Эта запись была [...]
June 23rd, 2005 at 6:07 am 23 июня 2005 года в 6:07 утра
You little beauty - this had been driving me mad. Вы немного красоты - это было движущей меня с ума. Your example has lots of unrequired backslashes for some reason though Ваш пример имеет множество unrequired слэш по некоторым причинам, хотя
June 23rd, 2005 at 6:26 am 23 июня 2005 года в 6:26 утра
@Paul @ Павла
The backslashes are an unfortunate artifact of the CMS software I am using. Слэш являются прискорбно артефакт CMS программного обеспечения я использую.
I have removed them now. Я был удален их сейчас.
August 12th, 2005 at 1:35 pm 12 августа 2005 года в 1:35 вечера
How about if you have frameset and frame is resized, applet does not get resized. Как насчет если у вас есть фреймов и размер кадра, апплет не получает размер.
applet gets resized only after window reload. апплет получает изменении размера окна только после перезагрузки.
sequence: последовательности:
have a frame set with Jtree in one frame иметь набор фреймов с Jtree в один кадр
applet in another frame, I want to resize апплет в другой кадр, я хочу, чтобы изменить размер
the applet when frame is resized. апплет при изменении размера кадра.
the window reload, resize it works, but not frame resize by dragging the frame boundary between two frames. перезагрузки окна, изменение размера он работает, но не размер кадра, перетаскивая границы кадра между двумя рамами.
June 9th, 2008 at 9:00 am 9 июня 2008 года в 9:00 утра
The applet is not working anymore Апплет не работает больше